Kunal  Gautam
What is a static constructor in C#?
By Kunal Gautam in C# on Jun 06 2013
  • Pramod Verma
    Feb, 2015 10

    1) A class can have one and only one Static Constructor. 2) The Static Constructor should not have any access modifier. 3) Static Constructors should not have any parameters. 4) The Static constructor will be executed only one time irrespective of number of objects created 5) Runtime invokes the Static Constructor when it creates an instance of the class or before the first static member being accessed. 6) The Static Constructor executes before any of the instance level constructors.

    • 1
  • Sara MeCaal
    Aug, 2014 30

    constructor are only default ,parameterised and copy i didn't ever listen static constructor ... but static word can use with constructors ... like public sara() { Console.writeLine(" its non static and have an extra place in heap"); } static public sara() { console.writeLine("its static,and the value place on the same place no extra space here use it "); }

    • 0
  • Sara MeCaal
    Aug, 2014 30

    constructor are only default ,parameterised and copy i didn't ever listen static constructor ... but static word can use with constructors ... like public sara() { Console.writeLine(" its non static and have an extra place in heap"); } static public sara() { console.writeLine("its static,and the value place on the same place no extra space here use it "); }

    • 0
  • Ranjit Powar
    Apr, 2014 23

    A constructor that is declared using static modifier is a static constructor. Static constructor executes one and only one time in the life cycle of class. It is the first block of code to execute in class. A static constructor can not be parametrized.

    • 0
  • Ranjit Powar
    Apr, 2014 23

    A constructor that is declared using static modifier is a static constructor. Static constructor executes one and only one time in the life cycle of class. It is the first block of code to execute in class. A static constructor can not be parametrized.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS