Confusion about Nullable<T> constraints

Posted by n535 on Stack Overflow See other posts from Stack Overflow or by n535
Published on 2010-04-07T21:59:07Z Indexed on 2010/04/07 22:03 UTC
Read the original article Hit count: 258

Filed under:
|
|

Greetings everybody. I am sorry, if this was already asked before (searched in vain) or is really very simple, but i just can't get it. The MSDN definition of a Nullable type, states, that it is defined in a following manner:

[SerializableAttribute]
public struct Nullable<T>
where T : struct, new()

So the question is quite straightforward: How is this definition possible? Or this is just a typo? Every value type already has a default constructor. Indeed, when i try to compile something like this, the compiler reasonably says, that it is illegal to apply both constraints at the same time, because the second one is implicitly included in a first one.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#