In .NET, a value type (C# struct
) can\'t have a constructor with no parameters. According to this post this is mandated by the CLI specification. What happens i
A struct is a value type and a value type must have a default value as soon as it is declared.
MyClass m;
MyStruct m2;
If you declare two fields as above without instantiating either, then break the debugger, m
will be null but m2
will not. Given this, a parameterless constructor would make no sense, in fact all any constructor on a struct does is assign values, the thing itself already exists just by declaring it. Indeed m2 could quite happily be used in the above example and have its methods called, if any, and its fields and properties manipulated!