J
Jack Robertson
Hi there,
Is it possible to write the following function as a template where
"EnumFlags" becomes template parameter T (where T will always be an
enumerator with the "FlagsAttribute"). Nothing I've tried works, including
use of a "where" clause since T must always be of type "System.Enum". Thanks
in advance.
void SetFlag(EnumFlags Flag, ref EnumFlags Flags, bool On)
{
if (On)
{
Flags |= Flag;
}
else
{
Flags &= ~Flag;
}
}
Is it possible to write the following function as a template where
"EnumFlags" becomes template parameter T (where T will always be an
enumerator with the "FlagsAttribute"). Nothing I've tried works, including
use of a "where" clause since T must always be of type "System.Enum". Thanks
in advance.
void SetFlag(EnumFlags Flag, ref EnumFlags Flags, bool On)
{
if (On)
{
Flags |= Flag;
}
else
{
Flags &= ~Flag;
}
}