I want to read the all elements under <appSettings> tag in a loop.
this is my app.config file
currently I am using the following code to read the elements . but I would like to read the elements (under appsettings) in a loop . If in future if new elements are added or deleted under appSettings tag, I don't want to make any changes to my application. Basically, instead of hard coding the element name, I would like to read all the elements under <appSettings> in a loop. How can I do that ? I can load the appSettings into an XMLDocument object and traverse but I was wondering if there is any better wa.Code:<appSettings> <add key="SourceFile_Advances" value="C:\Code\SavvysoftValuations\MV ADVS.csv" /> <add key="DestinationFile_Advances" value="C:\Code\SavvysoftValations\Destination\MV ADVS.csv"/> <add key="SourceFile_aaa" value="C:\Code\SavvysoftValuations\MV SWPS.csv" /> <add key="DestinationFile_aaa" value="C:\Code\SavvysoftValations\Destination\MV SWPS.csv"/> </appSettings>
Code:_valuations_Advances_sourceFile = System.Configuration.ConfigurationSettings.AppSettings["SourceFile_Advances"]; _valuations_advances_destinationFile = System.Configuration.ConfigurationSettings.AppSettings["DestinationFile_Advances"];


Reply With Quote
