मैं क्लाइंट को भेजने से पहले XElement से अपने सभी एक्सकॉममेंट को हटाने की उम्मीद कर रहा था।XElement से XComments को कैसे निकालें?
किसी कारण यह काम नहीं करता और removeMe.Count() = 0कोई विचार से
?
{
// ...
myXml = XElement.Load(myPath);
var removeMe=myXml.Descendants().Where(x => x.NodeType == XmlNodeType.Comment);
removeMe.Count(); // this is 0 , (not what i was expected)
removeMe.Remove();
//...
string myResponseStr = myXml.ToString(SaveOptions.None);
context.Response.ContentType = "text/plain";
context.Response.Write(myResponseStr);
}
xml फ़ाइल कि
<user>
<name> Elen </name>
<userSettings>
<color> blue </color> <!-- the theme color of the page -->
<layout> horizontal </layout> <!-- layout choise -->
<!-- more settings -->
</userSettings>
</user>
धन्यवाद। एक आकर्षण की तरह काम करता है ... –