c# – Delegates

What if you want the output of one method, to be treated as an input parameter for another method? i.e. you want to do something similar to linux bash piping in the world of c#, but instead of piping from one command, to another, you are piping from one method […]Read more »

c# – Abstract Classes

When you organise your code into parent and child classes (in order to fully utilize the concept of inheritance in order to cut down code duplication), you may end up with parent classes, that are just there for the purpose of holding base-class code. The class itself isn’t needed for […]Read more »

c# – The Interface

We previously came across the concept of inheritance, which is where a child class (implicitly) inherits the properties and methods from it’s parent class. However what if you don’t want a class to inherit methods and properties, but we do want class to have certain members (properties and methods) with […]Read more »

c# – Intro to Exceptions

Sometimes you might have a block of “dangerous code” in your program. These are code that could fail. When these blocks of “dangerous codes” fail, it will stop the program straight, and won’t attempt to carry on any further, and instead it will just output an error message. However sometimes […]Read more »

c# – Using the “Null” object

Sometimes a method will ask for an input parameter, but that input parameter is optional. In these situation you can still trigger the method, without passing an input parameter, and instead pass in a “null” object in it’s place:

c# – Generics: Dictionary (aka hashtable)

In c#, dictionaries are the same thing as hashtables. Dictonaries are a bit like arrays where you can customise the default index numbers to something more meaningful, here’s an example: Dictionaries are really powerful, and one of things it often gets used for is to create a dictionary where the […]Read more »

c# – Generics: Stack

Stacks are practically the same thing as Queues, but works on the basis of last-in, first-out. Here is the stack’s reference page: http://msdn.microsoft.com/en-us/library/3278tedw(v=vs.110).aspx It basically works in the opposite order of how a queue works. Here’s an example:

c# – Generics: Queue

Queues are like lists, but works on the basis of first-in, first-out, here’s an example:

c# – Generics: Lists

Arrays have a big limitation is that you cant extend the array to hold more than the number items it was originally defined to hold. As a result a lot of people uses “lists” as an alternative. You can find the lists class in the following namespace: System.Collections.Generic Here is […]Read more »

c# – Arrays

Arrays are used to store a a group of items as a collection: Tip: In the above examples we used the for-loop to process each item in the variable. However, it is often easier to use the foreach loop instead (we will do this in our next example). Arrays can […]Read more »