F
farseer
Hi,
I have a class which defines a few integer Constants:
public class AppConst
{
public const int XVALUE = 100;
public const int YVALUE = 200;
public const int YVALUE = 300;
}
I'd like to write a procedure in which i can pass the constant name as
a string and be able to retrieve the constant value. for instance
//method definition
public int getConst( string constName ){...}
//usage
int x = getConst( "XVALUE" );
I assume i can use reflection to do this. Can someone tell me how
please?
(The reason i want to do this is that i want to use the constant name
in a properties file rather than the value)
thank you
I have a class which defines a few integer Constants:
public class AppConst
{
public const int XVALUE = 100;
public const int YVALUE = 200;
public const int YVALUE = 300;
}
I'd like to write a procedure in which i can pass the constant name as
a string and be able to retrieve the constant value. for instance
//method definition
public int getConst( string constName ){...}
//usage
int x = getConst( "XVALUE" );
I assume i can use reflection to do this. Can someone tell me how
please?
(The reason i want to do this is that i want to use the constant name
in a properties file rather than the value)
thank you