I have the following generic function:
public SomeType SomeFunction<T>(T value)
{
}
I would now like to restrict this generic function to work only with Enum
s so I tried the following:
public SomeType SomeFunction<T>(T value) where T : System.Enum
{
}
But this resulted in:
error CS0702: Constraint cannot be special class 'System.Enum'
Is there a work around and out of curiosity does anyone know the reason why this type of constraint isn't allowed?