Constructor in C#


I want to share my knowledge on Constructor in C# is,

Constructor is special method of the class that is automatically invoked when an instance of the class is created is called a constructor. The main use of constructors is to initialize private fields of the class while creating an instance for the class.

Image result for constructor c#


C# Constructors with Examples. In c#, Constructor is a method which will invoke automatically whenever an instance of class or struct is created. The constructor will have a same name as the class or struct and it useful to initialize and set a default values for the data members of the new object.

Comments