c# - dynamic variables as property indicators for .net objects -


this question has been asked here js
how access object property using variable
how access dynamic property: objectname.{variable}

however im looking how asp.net mvc4
syntax js gives me errors .net

basically
trying access property of object using dynamic variable

so example
if have var k="myprop" , have object o
statement var v = o.k;
return value of o.myprop not o.k
(which return err if o not have property named "k")

you need use reflection, means getting type object represent type of object property value want get, getting propertyinfo property , getting value of property object. there plenty of examples around.

by way, there's nothing "dynamic" variable. it's variable, i.e. value can vary. dynamic variable 1 declared dynamic, yours not.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -