A
Allan Rojas
Hi there, i'm new to reflection, i'm trying to retrieve a constant value,
but my code is not working:
....
public const int XXX = 5;
public void main()
{
System.Reflection.FieldInfo fi = this.GetType().GetField("XXX");
int temp = (int)fi.GetValue(this);
}
....
If i change the 'XXX' declaration to not-a-constant, the value is retrieved
successfully.
but my code is not working:
....
public const int XXX = 5;
public void main()
{
System.Reflection.FieldInfo fi = this.GetType().GetField("XXX");
int temp = (int)fi.GetValue(this);
}
....
If i change the 'XXX' declaration to not-a-constant, the value is retrieved
successfully.