I have a class that contains several enumerateds, like this:
public class MyEnumerateClass
{
public enum Enum1
{
enum1Value1,
enum1Value2
}
public enum Enum2
{
enum2Value1,
enum2Value2
}
}
I have a method that takes any of that Enums like this:
public void GetValue(MyEnumerateClass enumerateField)
{
switch (enumerateField)
{
case enum1Value1:
... do stuff here ...
break;
.......... stuff ..........
}
}
As we can appreciate, that GetValue
allows me to accept any of the two values declared previously. But I have a problem:
When I need to check the enumerate type and check if it's Enum1
or Enum2
, I don't know how to handle it...
public void GetType(MyEnumerateClass enumerateField)
{
enumerateField.values(); // To do this I need to know the type of the enumerate
}
So, how can I get the enumerate type if it's inside MyEnumerateClass
?