Constructors (C# Programming Guide)


Updated: July 20, 2015

System_CAPS_ICON_note.jpg Note

For the latest documentation on C#, visit the C# Guide on

Whenever a class or struct is created, its constructor is called. A class or struct may have multiple constructors that take different arguments. Constructors enable the programmer to set default values, limit instantiation, and write code that is flexible and easy to read. For more information and examples, see Using Constructors and Instance Constructors.

If you do not provide a constructor for your object, C# will create one by default that instantiates the object and sets member variables to the default values as listed in Default Values Table. For more information and examples, see Instance Constructors.

Static classes and structs can also have constructors. For more information and examples, see Static Constructors.

Using Constructors

Instance Constructors

Private Constructors

Static Constructors

How to: Write a Copy Constructor

C# Programming Guide
Classes and Structs
Why Do Initializers Run In The Opposite Order As Constructors? Part One