WHAT IS A STATIC CONSTRUCTOR?

Sumit Kesarwani

Total Post:0

Points:0
Posted by  Sumit Kesarwani
.NET  C# 
C#
 981  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    What is a static constructor?

    Static constructors are introduced with C# to initialize the static data of a class. CLR calls the static constructor before the first instance is created. 

    The static constructor has the following features:

    No access specifier is required to define it.

    You cannot pass parameters in static constructor.

    A class can have only one static constructor.

    It can access only static members of the class.

    It is invoked only once, when the program execution begins.

      Modified On Mar-27-2018 05:21:39 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!