Remove Dups From Array List


private static string[] RemoveDuplicates(ArrayList arrList)
{
        HashSet<string> Hset = new HashSet<string>((string[])arrList.ToArray(typeof(string)));
        string[] Result = new string[Hset.Count];
        Hset.CopyTo(Result);
        return Result;
}
Partial Class :

A class defined in  two or more files is called a partial class. The keyword partial is used to define the class. When working on large projects, spreading a class over separate files allows multiple programmers to work on it simultaneously. During compile time all the partial class are compiled into one type only.
Delegate :
Delegate is a type which  holds the method(s) reference in an object. It is also referred to as a type safe function pointer.

delegate void Delegate_Multicast(int x, int y);
Class Class2
{
    static void Method1(int x, int y)
    {
        Console.WriteLine("You r in Method 1");   }
    static void Method2(int x, int y)
    {
        Console.WriteLine("You r in Method 2");
    }
    public static void Main()
    {
        Delegate_Multicast func = new Delegate_Multicast(Method1);
        func += new Delegate_Multicast(Method2);
        func(1,2);             // Method1 and Method2 are called
        func -= new Delegate_Multicast(Method1);
        func(2,3);             // Only Method2 is called
    }
}
Serialization :

Serialization is the process of saving the state of an object in a persistent storage media by converting the object to a linear stream of bytes.
The object can be persisted to a file, a database or even in the memory
The following are the basic advantages of serialization:
-          Facilitate the transportation of an object through a network
-          Create a clone of an object
Serialization can be of the following types:
         Binary Serialization
        SOAP Serialization
        XML Serialization
        Custom Serialization
Singleton Class :

A singleton is a class which only allows a single instance of itself to be created, and usually gives simple access to that instance.
public sealed class Singleton{
    static Singleton instance=null;
    static readonly object padlock = new object();
   Singleton()    {    }
    public static Singleton Instance    {
        get {
            lock (padlock)
            {
                if (instance==null) {  instance = new Singleton();}
                return instance;
           } }    } }

Static Class


Static classes can not be instantiated.
Static classes are sealed so they can not be inherited.
Only static members are allowed.
Static classes can only have static constructor to initialize static members.

EX : Public static class MyStaticClass
{
Private static int _staticVariable;
Public static int staticVariable;
{
Get
{
Return _staticVariable;
}
Set
{
_staticVariable = value;
}
}
Public static void Function()
{
}
}Public static class MyStaticClass
{
Private static int _staticVariable;
Public static int staticVariable;
{
Get
{
Return _staticVariable;
}
Set
{
_staticVariable = value;
}
}
Public static void Function()
{
}
}
Sealed Class :
Once a class is defined as sealed class, this class cannot be inherited.
If you have ever noticed, structs are sealed. You cannot derive a class from a struct. 
One of the best usage of sealed classes is when you have a class with static members

public sealed class MySingleton {
public static readonly MySingleton Instance = new MySingleton();
private MySingleton(){ }
}

interface :
The members of the interface are public with no implementation. Abstract classes can have protected parts, static methods, etc.
A class can inherit one or more interfaces, but only one abstract class.
Abstract classes can add more functionality without destroying the child classes that were using the old version. In an interface, creation of additional functions will have an effect on its child classes, due to the necessary implementation of interface methods to classes.

interface iSampleInterface
{
  //All methods are automaticall abstract
  int AddNumbers(int Num1, int Num2);
  int MultiplyNumbers(int Num1, int Num2);
}

Abstract Class :
-          An abstract class means that, no object of this class can be instantiated, but can make derivations of this.
-          An abstract class can contain either abstract methods or non abstract methods.
-          An abstract class cannot be a sealed class. I.e. the following declaration is incorrect.
-          An abstract method cannot be private.
-          The access modifier of the abstract method should be same in both the abstract class and its derived class
-          An abstract method cannot have the modifier virtual. Because an abstract method is implicitly virtual.
-          An abstract member cannot be static

EX :
abstract class absClass1
{
    public abstract int AddTwoNumbers(int Num1, int Num2);
    public abstract int MultiplyTwoNumbers(int Num1, int Num2);
}
//Abstract Class2
abstract class absClass2:absClass1
{
    //Implementing AddTwoNumbers
    public override int AddTwoNumbers(int Num1, int Num2)
    {
        return Num1+Num2;
    }
}
//Derived class from absClass2
class absDerived:absClass2
{
    //Implementing MultiplyTwoNumbers
    public override int MultiplyTwoNumbers(int Num1, int Num2)
    {
        return Num1*Num2;   
    }
 }
Class :

A user-defined data structure that groups properties and methods. Class doesn’t occupies memory.

Object :


Object is a Building and the class is a blueprint. Instance of Class is called object. 
An object is created in memory using keyword “new”.

Property :

Attribute of object is called properties. Eg1:- A car has color as property

Encapsulation :
Encapsulation is a process of binding the data members and member functions into a single unit.

Abstraction :

Abstraction is a process of and displaying the essential features and hiding the implementation details.

Inheritance :

Reusability of Base class members in Derived Class is called Inheritance.

Polymorphism :

When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.

Polymorphism is of two types: 

-          Compile time polymorphism (Early Binding)/Overloading
-          Runtime polymorphism (LateBinding)/Overriding
-           
Operator Overloading :

using System; // A three-dimensional coordinate class. 
class ThreeD { 
  int x, y, z; // 3-D coordinates   
  public ThreeD() { x = y = z = 0; } 
  public ThreeD(int i, int j, int k) { x = i; y = j; z = k; } 
  public static ThreeD operator +(ThreeD op1, ThreeD op2)   // Overload binary +. 
  { 
    ThreeD result = new ThreeD(); 
    /* This adds together the coordinates of the two points and returns the result. */ 
    result.x = op1.x + op2.x; // These are integer additions 
    result.y = op1.y + op2.y; // and the + retains its original 
    result.z = op1.z + op2.z; // meaning relative to them. 
    return result; 
  }   // Show X, Y, Z coordinates. 
  public void show() 
  { 
    Console.WriteLine(x + ", " + y + ", " + z); 
  } 

public class ThreeDDemo { 
  public static void Main() { 
    ThreeD a = new ThreeD(1, 2, 3);  ThreeD b = new ThreeD(10, 10, 10);  ThreeD c = new ThreeD(); 
    c = a + b;    c.show();     c = a + b + c;      c.show();    } 
}