How do all!
I want to be able to access a value in a class using the variable passed to a procedure.
e.g. _results.projection[2].Current.FundDC to become something like
_results.projection[2].termId.varName
where termId can be Current, Future or Percent
and varName can be a large list 🙂
Any suggestions?
Answers on a postcard please 🙂
You can do this with reflection using
Type.GetPropertyto get aPropertyInfoand thenPropertyInfo.GetValueto get the value.Alternatively you could just switch on the name passed to you… both are somewhat icky, to be honest. Is the only way of receiving this information as a string? What’s the bigger picture here?