I have two xml files but one file will contain an extra field. Ideally I would like to add an if statement withing the XElement but I dont think its possible.
Obviously this is horribly wrong, its just an example to give you some idea what I would like to do:
XElement xml = XElement.Load(pfileLocation);
xml.Add(new XElement("Something",
new XAttribute("widgit", pwidgitID),
if (pfileLocation == "file1.xml")
new XElement("Foo", pfoo),
new XElement("Bar", pbar)));
xml.Save(pfileLocation);
My guess is that I should pass it into an overloaded method?