I want to get the default value of a type of a field. I wish to have something like the following code (which of course does not compile):
public class foo
{
public int intf;
public string strf;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine(default(foo.intf)); //Expected default(int)
Console.WriteLine(default(foo.strf)); //Expected default(string)
}
}
Is there any way to do that?