Is there a way I can determine the name of the variable that is being accessed.
In the following example, when I call Item22.Description (or any other property of BigClass), I'd like to be able to find variablename (Item22 in this case).
CODE
class BigClass
{
public static Hashtable DescriptionsTable; //this would be a singleton
DataItem Item01;
.... DataItem Item64;
}
class DataItem
{
double _Value;
string Description
{ get { return BigClass.DescriptionsTable[variablename]; } }
}
If I don't have access to this name I figure I'll have to add a second property to BigClass for each Item (ex. Item22Description...), which seems like a waste. And I don't want to have the descriptions in each BigClass because they can get quite lengthy and there will be hundreds of BigClass instances at a time.
Any ideas?
If there's another option, how could I re-architect without wasting too much space?