i am finding and replacing data in xml now by linq this way
XDocument xmlDoc = XDocument.Load(files);
var items = (from item in xmlDoc.Descendants("TickerBrokerStandardDateLineitemValue")
where item.Element("TabName").Value.Trim().ToUpper() == olditem.Trim().ToUpper()
select item).ToList();
foreach (var item in items)
{
item.Element("TabName").SetValue(newitem);
}
xmlDoc.Save(files);
it is working but the problem is if there few values for TabName field looks bit similar then those data also updating.
see two data for TabName
1) Net Revenue
1) Net Revenue Consolidated
so when i will replace only Net Revenue then Net Revenue Consolidated is also updated which i do not want. i want to search by exact tabname value and replace that exact data not other similar data.
how to achieve it with LINQ?
i found one link but not sure does it solve my purpose @AngelinaJoli second answer
https://forums.asp.net/t/2124481.aspx?LINQ+How+to+Check+only+matching+string+based+on+conditions+in+LINQ+Query
please share a code example. thanks