0% found this document useful (0 votes)
3 views

Types of Constructors in c#

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Types of Constructors in c#

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

TYPES OF CONSTRUCTORS IN C#

Constructors generally following types:


 Default Constructor
 Parameterized constructor
 Private Constructor
 Static Constructor
 Copy Constructor
STATIC CONSTRUCTOR
 A static constructor is used to initialize static variables of the class
and to perform a particular action only once.
 Static constructor is called only once, no matter how many objects
you create.
 Static constructor is called before instance constructor.
 A static constructor does not take any parameters and does not
use any access modifiers.
Key points of static constructor
 Only one static constructor can be created in the class.
 It is called automatically before the first instance of the class
created.
 We cannot call static constructor directly.

You might also like