Static constructors are default constructors of Static class.
This constructor is called at very first time whenever we declare static class variable.
namespace Interviews.OOPSConcepts
{
public class StaticClasses
{
static StaticClasses()
{
Console.WriteLine("This is Static Constructor.");
}
private int rollNumber = 0;
public int RollNumber
{
get { return rollNumber; }
set { rollNumber = value; }
}
}
}
No comments:
Post a Comment