Hey, On Fri, Feb 5, 2010 at 2:27 PM, Anatoly <[email protected]> wrote: > How to get underlaying numeric type for enum from TypeDefinition?
I use this when I know that self.IsEnum == true
public static TypeReference GetEnumUnderlyingType (this
TypeDefinition self)
{
var fields = self.Fields;
for (int i = 0; i < fields.Count; i++) {
var field = fields [i];
if (field.Name == "value__")
return field.FieldType;
}
throw new ArgumentException ();
}
--
Jb Evain <[email protected]>
--
--
mono-cecil
