using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NonParameterizedConst
{
class Program
{
int x;
public Program() // non-parameterized constructor
{
x = 10;
}
static void Main(string[] args)
{
Program obj1 = new Program();
Console.WriteLine(obj1.x);
Program obj2 = new Program();
Console.WriteLine(obj2.x);
Console.ReadKey();
}
}
}
In the above example the constructor will be invoked by the CLR for two times since two objects are created. In this the constructor will assign same value for all the objects.