F
Freddy Willockx
Hi
I'm doing some actions through reflection and generating some source code to
speed up my actions.
But, when I'm generating source code to read and write the fields of an Enum
type, it goes wrong. An internal field "Value__" is added to the field.
The problem is that this field is marked as public and not as private.
Because this field is marked as public, my code generator assumes, he can
access this property directly and generates source like
MyEnum.Value__ = ReadInteger();
if the property would be marked private I would generate
FieldInfo.SetValue(MyEnum, ReadInteger());
On private fields I use reflection, on public I try to go direct.
if could test if the fieldname equals "Value__", but I find this very lame.
Is their something else I can test up on to check wheter I could access this
field directly?
kind regards
Alexander
I'm doing some actions through reflection and generating some source code to
speed up my actions.
But, when I'm generating source code to read and write the fields of an Enum
type, it goes wrong. An internal field "Value__" is added to the field.
The problem is that this field is marked as public and not as private.
Because this field is marked as public, my code generator assumes, he can
access this property directly and generates source like
MyEnum.Value__ = ReadInteger();
if the property would be marked private I would generate
FieldInfo.SetValue(MyEnum, ReadInteger());
On private fields I use reflection, on public I try to go direct.
if could test if the fieldname equals "Value__", but I find this very lame.
Is their something else I can test up on to check wheter I could access this
field directly?
kind regards
Alexander