Updating app.config using LINQ

iwexdotalr

New Member
I have an app.config file.I want to retrive and edit an attribute:\[code\]<appSettings> <add key="ProcessorInstances" value="http://stackoverflow.com/questions/11397711/2" /></appSettings>\[/code\]I am using this query:\[code\]var list5 = from appNode in doc2.Descendants("appSettings").Elements() where appNode.Attribute("key").Value =http://stackoverflow.com/questions/11397711/="ProcessorInstances" select appNode;var element5 = list5.FirstOrDefault();string five = element5.Attribute("value").Value; \[/code\]But now I am facing elements like:\[code\]<app> <file value="http://stackoverflow.com/logs/Intel.Service.log" /></app>\[/code\]and:\[code\]<baseAddresses> <add baseAddress="http://Machinename:portnumber/servicename/" /></baseAddresses>\[/code\]These elements don't have any key attribute.How can I write a LINQ query to edit them?
 
Back
Top