What does 'struct' restriction mean?
It means any non-nullable value type. All structs are value types.
I want to know It means structs only or any type derived from value type like int, double, enum, ant so on. Is the next code let me to use simple types?
Your so-called "simple types", like int
, double
and enum
are nothing more than C# keywords that correspond to the System.Int32
and System.Double
structs, and System.Enum
class which is based on System.ValueType
(which makes enums also value types, despite Enum
being a class itself).
Therefore these types also satisfy the where T : struct
constraint, along with regular structs.