I have the following enum
:
enum Crank { X = 0, Y = 1 }
However when I try
if (x == Crank.X)
I get an error indicating
cannot convert from Crank to int
Where do i go wrong?
I have the following enum
:
enum Crank { X = 0, Y = 1 }
However when I try
if (x == Crank.X)
I get an error indicating
cannot convert from Crank to int
Where do i go wrong?
If x is of type integer, you need to cast the enum value to an int to compare
if(x==(int)Crank.X)