ConfigurationSettings.AppSettings[" ConfigurationSettings.AppSettings"]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken

    ConfigurationSettings.AppSettings[" ConfigurationSettings.AppSettings"]

    I'm currently using 1.1.
    Is there any way using the value of a
    ConfigurationSe ttings.AppSetti ngs["something"] as a key of
    ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["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 = ConfigurationSe ttings.AppSetti ngs["car"] .ToString();

    string car =
    ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["car"] ].Tostring();




  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: ConfigurationSe ttings.AppSetti ngs[&quot; ConfigurationSe ttings.AppSetti ngs&quot;]

    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 = ConfigurationSe ttings.AppSetti ngs["car"] ;
    string car = ConfigurationSe ttings.AppSetti ngs[company ];

    or

    ConfigurationSe ttings.AppSetti ngs[
    ConfigurationSe ttings.AppSetti ngs["car"] ]


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

    "Ken" <klee@jeromegro up.comwrote in message
    news:u9fgITmlHH A.4900@TK2MSFTN GP05.phx.gbl...
    I'm currently using 1.1.
    Is there any way using the value of a
    ConfigurationSe ttings.AppSetti ngs["something"] as a key of
    ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["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 = ConfigurationSe ttings.AppSetti ngs["car"] .ToString();
    >
    string car =
    ConfigurationSe ttings.AppSetti ngs[ConfigurationSe ttings.AppSetti ngs["car"]
    ].Tostring();
    >
    >
    >
    >

    Comment

    Working...