- I have noticed that when calling
GetFields()on enum type, I’m getting an extra fields with type int32. where did it come from?? - When I call the other overload
(GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static) ), it returns the desired fields. is that means that the enum’s fields are not Public ?
thanks
ReflectorIL Spy can explain this.Take a look at a decompiled enum and you will see something that looks like this:
i.e. the
Fooenum is implemented as a sealed class that wraps anint32calledvalue__– the extra field you are seeing.Its worth noting that it also inherits from
System.Enumwhich also has extra (static) fields.