ConfigurationSettings.AppSettings[" ConfigurationSettings.AppSettings"]

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I'm currently using 1.1.
Is there any way using the value of a
ConfigurationSettings.AppSettings["something"] as a key of
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["something"].Tosting(
)]?

for example in web.config
<add key="company" value="Hyundai" />

<add key="Hyundai" value="sonata" />

in cs code, How should I change the the code for "string car"?

string company = ConfigurationSettings.AppSettings["car"] .ToString();

string car =
ConfigurationSettings.AppSettings[ConfigurationSettings.AppSettings["car"] ].Tostring();
 
Hi,

I do not understand your post, of course you can use the value of a key as
the key for another value:

string company = ConfigurationSettings.AppSettings["car"] ;
string car = ConfigurationSettings.AppSettings[company ];

or

ConfigurationSettings.AppSettings[
ConfigurationSettings.AppSettings["car"] ]


There is no need to use ToString() as a string is already being returned.
 
Back
Top