Type parameter is not allowed for constant type.
Because a struct
cannot be made const
(from C# specification 10.4 Constants)
The type specified in a constant declaration must be
sbyte
,byte
,short
,ushort
,int
,uint
,long
,ulong
,char
,float
,double
,decimal
,bool
,string
, an enum-type, or a reference-type.
A kind of workaround to this limitation is to declare it as static
readonly
.
public static readonly ValueType val = default(ValueType);