2
I have the following code:
enum type = { OPEN = 0, CLOSED, UNDEFINED};
list<int> frequencia = new list<int>(new int[] {0,0,0});
I would later like to carry out the following operation:
type t = enum.OPEN;
frequencia[t]++;
but I can’t. Any solution on how to convert the Enum variable to int?
Just do a type-cast:
(int)enumValue
.– Miguel Angelo
In C# the default encoding is to use "Open, Closed, Undefined" without ALL CAPS.
– Maniero
@Miguelangelo, that’s just what I needed. Thank you!
– user6635
@bigdown, thanks for the tip. I’ll adopt it.
– user6635