Here's my code to get the three parameters from a configuration!
C# Code:
Configuration configuration = ConfigurationManager.OpenExeConfiguration(dllConfigFile); var appSettings = configuration.AppSettings.Settings; foreach (KeyValueConfigurationElement keyValueConfigurationElement in appSettings) { switch(keyValueConfigurationElement.Key) { case "WSUser": UserId = keyValueConfigurationElement.Value; break; case "WSUserPassword": UserPassword = keyValueConfigurationElement.Value; break; case "endpointurl": EndPointUrl = keyValueConfigurationElement.Value; break; } }
I want to eliminate the loop completely and just go after the specific key. I know the key names, so what is the syntax to do this?




Reply With Quote
