M
Mark Olbert
Given:
public enum SomeEnumType : int
{
None = 0,
}
int b = 0;
why does the following cast succeed:
SomeEnumType a = (SomeEnumType) b;
while the following conversion fails:
SomeEnumType a = Convert.ChangeType(b, typeof(SomeEnumType));
Is there a "generic" way of converting integer values into integer-based enums?
- Mark
public enum SomeEnumType : int
{
None = 0,
}
int b = 0;
why does the following cast succeed:
SomeEnumType a = (SomeEnumType) b;
while the following conversion fails:
SomeEnumType a = Convert.ChangeType(b, typeof(SomeEnumType));
Is there a "generic" way of converting integer values into integer-based enums?
- Mark