Say I have a struct
public struct Foo
{
...
}
Is there any difference between
Foo foo = new Foo();
and <
The language specification (§4.1.2 and §5.2) is your friend. Specifically:
For a variable of a value-type, the default value is the same as the value computed by the value-type’s default constructor (§4.1.2).
(Italics in original.)
Note that this is not the same for reference types.
For a variable of a reference-type, the default value is
null
.
This is emphatically different than the value produced by a default constructor, if one exists.