in the below code who is assigning the value for the variable a
? why a default constructor is created when I did not write anything about it in the code (I checked the ildasm for it where an default constructor is created )
contents in the created default constructor:
method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 8 (0x8)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [System.Runtime]System.Object::.ctor()
IL_0006: nop
IL_0007: ret
} // end of method Program::.ctor
Code:
using System;
namespace demo
{
class Program
{
int a;
static void Main(string[] args)
{
Program obj = new Program();
Console.WriteLine(obj.a);
Console.ReadLine();
}
}
}
in the above code the output is 0, who assigned the value for it? either default constructor created or CLR?
instance void [System.Runtime]System.Object::.ctor()
What does this mean in the ildasm code of the default constructor