C# Constructor

A constructor is a special method that gets called automatically when an object of a class is created. Constructors are specially used to initialize data members.
Types of constructors:-
1.     Default Constructor
2.     Parameterized Constructor
3.     Copy Constructor
4.     Static Constructor



   public class SampleClassNitin
    {
        public SampleClassNitin()
        {
            Console.WriteLine("SampleClassNitin  Test Method");
        }


    }

Default Constructor
A constructor without having any parameters called the default constructor.

Parameterized Constructors
A constructor with at least one parameter is called as parameterized constructor.

Constructor Overloading
When we create another constructor with the same method name with different parameters called Constructor Overloading.

Copy Constructor
A parameterized constructor that contains a parameter of same class type is called as copy constructor.

Static Constructor

If we declared constructor as static and it will be invoked only once that type of constructor is called Static Constructor.