Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 8
    You'll have to be a bit more explicit about how this is implied by the value vs. reference type split I don't get it... Commented Dec 2, 2008 at 19:05
  • Value types have a default value- they are not null, even if you don't define a constructor. While at first glance this doesn't preclude also defining a default constructor, the framework using this feature internal to make certain assumptions about structs. Commented Dec 2, 2008 at 21:50
  • @annakata: Other constructors are probably useful in some scenarios involving Reflection. Also, if generics were ever enhanced to allow a parameterized "new" constraint, it would be useful to have structs that could comply with them. Commented Feb 24, 2012 at 1:39
  • @annakata I believe it's because C# has a particular strong requirement that new really must be written to call a constructor. In C++ constructors are called in hidden ways, at declaration or instanciation of arrays. In C# either everything is a pointer so start at null, either it's a struct and must start at something, but when you cannot write new... (like array init), that would break a strong C# rule. Commented Aug 25, 2016 at 9:36