Syntax for referring to variable name by string?

Feb 29 2004 9:09 PM
If I have member called: this.m_yodasShoeSize and I want to refer to it by a string with something like: this."m_" + "yodasShoeSize" is there syntax in c# for that. I expected something like: this["m_" + "yodasShoeSize"] or this[eval("m_" + "yodasShoeSize"); Also, is there a name for what I'm talking about here? I'm not sure what to call this feature, although I have seen it available in a few languages.

Answers (3)