Passing Enum type as a parameter
"we cannot pass a Type as a function parameter" ???Yes we can. Just look at the parameter of Enum.GetValues for example._______Generic functions are unnecessary here. Just use Object.GetType to, um, get the type.private Enum GetNextEnum(object currentlySelectedEnum){ Type...
"we cannot pass a Type as a function parameter" ???
Yes we can. Just look at the parameter of Enum.GetValues for example.
_______
Generic functions are unnecessary here. Just use Object.GetType to, um, get the type.
private Enum GetNextEnum(object currentlySelectedEnum)
{
Type enumList = currentlySelectedEnum.GetType();
_______
You could have used the generic type to return a value of the correct type.
private T GetNextEnum(T currentlySelectedEnum)
{
...
return (T)enums.GetValue(index);
}