I hope you are doing this on Page_Load
so check this
protected void Page_Load(object sender, EventArgs e)
{
e
contains the event data
So if you are using it inside any event then you have to replace your e
with something else like x
say ,
XDocument xml = XDocument.Load(loadLocation);
xml.Descendants().Elements("Hmi.Screen.Property")
.Where(x=> x.Attribute("Name").Value == "FitToLargest")
.Remove();
xml.Save(loadLocation);
try this
XDocument delete = XDocument.Load(@"D:\xxx\Delete.xml");
delete.Descendants("Hmi.Screen.Property").Where(
x => (string)x.Attribute("Name") == "FitToLargest").Remove();
//e => e.Attribute("Name").Value == "FitToLargest").Remove();
delete.Save(@"D:\xxxt\xxxx\Delete.xml");