1. C# Queue

    In my last post you can find explanation of Stack Collection. Concept of both collections is similar. …


  2. C# Stack

    Stack is a LIFO(last-in, first out) collection of objects. It’s generic type that is part of  System.Collections.Generic. You can read more about generics in my last post. There are three most important methods in this class: Peek(),Pop(),Push(). First lets explain the LIFO concept. …


  3. C# Action Delegate

    In last post about generics mentioned about Action delegate. Action is a type of delegates that takes 0 to 16 arguments and returns no value. It’s similar to void method. It’s part of System.collection.generic. Actions can point  to anonymous function in form of lambda expression. Let’s take a look at example.

    using System;
    
    


  4. C# Dictionary

    In last post about hashtables, I mentioned that there is more efficient type of hashtable called dictionary. I recommend you to read that article before moving to dictionaries. Dictionary is part of System.Generic. Concept of dictionary is the same as Hashtable , A It is a data structure that represents a collection of keys and values pair of data. In dictionaries we need to define the type of variable that will be stored in collection. This makes no need for boxing/unboxing process, what effects the collection performance. Dictionary is part of generic collection what means we can use it with any data types …


  5. Hashtable

    Hashtable is part of System.Collection namespace. You can read more about collections here. The Hashtable class represents a collection of key/value pairs that are organized based on the hash code of the key. A hash table is made up of a mapping function and an array. It uses the key to access the elements in the collection. The mapping function is used to assign numerical values (keys) to the data. This helps in categorizing the data, which speeds up search times when you search for it. Hashtable is an older .NET Framework type. It is slower than the generic Dictionary type. In hashtable we don’t declare type of the object with it signature. …


  6. Interfaces

    In post about abstraction abstract classes I used examples of method which  implementation is defined in derived class. Here is when Interfaces comes in play.  An interface contains only the signatures(declarations) of methods, properties, events or indexers. It looks like a class, but has no implementation. The reason interfaces only provide declarations is because they are inherited by classes and structs, which must provide an implementation for each interface member declared. It’s important to add that  Class can inherit from multiple interfaces, but not multiple classes. …


  7. Recursive function

    In simplest possible way, recursive function is a function that calls itself. It’s common for function to call another function, but when it calls itself its a recursive function.  Recursive method calls itself so many times until being satisfied, this method should call itself with new parameters to avoid infinite loop. …


  8. Lambda Expressions

    Lambda expressions is an anonymous function used to transform data and create shorter representations of normal function as delegates. In c# we use => operator to transform data. This subject is strongly related to delegates, I suggest you reading the delegates post first. Let’s take a look at syntax:

    (input parameters) => expression or statement block
    We pass lambda expressions as arguments of functions. …


  9. Abstraction

    This is the fourth principle of  object oriented programming. Abstraction is a concept related to polymorphism. Abstraction in programming means declaring the methods that will be defined in derived class. The idea of abstraction works well with large and complex projects,  where class contains multiple methods that performs different tasks. …


  10. Encapsulation

    Encapsulation, also known as information hiding, Is  the procedure of covering up of data and functions into a single class. Encapsulation is used to prevent the user of a given class from manipulating objects in ways that are not intended by the designer. This can be achieved by restricting access to the members. Unprotected data is vulnerable to accidental corruption due to the errors in other parts of program. …