Call a property using a string

  • Thread starter Thread starter Chad Miller
  • Start date Start date
C

Chad Miller

I have a class with 50 properties sp01 .. sp50 is there a way to call a
property using a string?
ex. o.sp & "01"

Chad
 
Chad Miller said:
I have a class with 50 properties sp01 .. sp50 is there a way to call
a property using a string?
ex. o.sp & "01"

You can, but be careful, the compiler won't complain if a name is missing:
see the CallByName statment and the topic "Reflection":
http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondiscoveringtypeinformationatruntime.asp

especially sub topic "Dynamically Loading and Using Types"


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Back
Top