Do you gain any operations when you constrain a generic type using where T : struct?
Posted
by Fiona Holder
on Stack Overflow
See other posts from Stack Overflow
or by Fiona Holder
Published on 2010-03-24T23:02:13Z
Indexed on
2010/03/24
23:03 UTC
Read the original article
Hit count: 312
This may be a bit of an abstract question, so apologies in advance.
I am looking into generics in .NET, and was wondering about the where T : struct
constraint.
I understand that this allows you to restrict the type used to be a value type. My question is, without any type constraint, you can do a limited number of operations on T.
Do you gain the ability to use any additional operations when you specify where T : struct
, or is the only value in restricting the types you can pass in?
© Stack Overflow or respective owner