c# - Calling unknown settings -


c# project in visual studio 2013

i need build x-walk (cross reference) between database's field names , list of 'standard' names.

because list needs maintained , updated, inclination create settings class , call setting cross reference. e.g.

[global::system.configuration.applicationscopedsettingattribute()] [global::system.diagnostics.debuggernonusercodeattribute()] [global::system.configuration.defaultsettingvalueattribute("size")] public string mysize {     {         return ((string)(this["mysize"]));     } } 

and called thus:

private string str = myproject.attributexref.default.mysize; 

here rub comes... @ run-time code have respond passing 'attributes' name , have perform lookup. if have 'mysize' , not myproject.attributexref.default.mysize;

should doing similar myproject.attributexref.{0}

or... going wrong?

and answer is...

var = "mysize"; var b = myproject.attributexref[a]; console.writeline("mysize = " + b); 

output - mysize = size


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -