5

OK, we hear that structcannot have a default parameterless constructor which is fine (http://stackoverflow.com/questions/333829/why-cant-i-define-a-default-constructor-for-a-struct-in-net). But documentation says "Each value type has an implicit default constructor that initializes the default value of that type." from http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx

What's the difference between implicit default constructor and parameterless default constructor right now?

Tarik
  • 79,711
  • 83
  • 236
  • 349

2 Answers2

6

The implicit default constructor is the parameterless constructor which is automatically created by the compiler. The reason you can't create a parameterless constructor is because the default one already exists. I don't know why they chose to do it this way, and why you're not allowed to override it.

HypnoToad
  • 585
  • 1
  • 6
  • 18
1

As explained in the answer you point to, using IL, you can define a parameterless constructor for a struct, but there are scenarios where it is not called.

IMHO the "implicit" constructor is just a logical one; implied by the memory being zeroed out when it is allocated.

Mark Hurd
  • 10,665
  • 10
  • 68
  • 101