Possible Duplicate:
Howto change what Default(T) returns in C#
print(default(int) == 0) //true
Similarly if I have a custom object, its default value will be null.
print(default(Foo) == null) //true
Can I have a custom value for default(Foo)
and not null?
For example, something like this:
public static override Foo default()
{
return new Foo();
}
This wont compile. Thanks..