I cannot retrieve the XML node comments. Is there a different way to retrieve it? .Value did not work either. I could not find anything here in StackOverflow. This is what I am doing:
<?xml version="1.0" encoding="utf-8"?>
<components>
<component name="AAA">
<sample>
<!-- blah blah blah -->
</sample>
<data>
<!-- blah blah blah -->
</data>
</component>
<component name="BBB">
<sample>
<!-- blah blah blah -->
</sample>
<data>
<!-- blah blah blah -->
</data>
</component>
</components>
public class Component
{
public string Name { get; set; }
public string Sample { get; set; }
public string Data { get; set; }
}
XDocument doc = XDocument.Load(xmlFileName);
Component components = doc.Descendants("component")
.Select(x => new Component
{
Name = (string)x.Attribute("name"),
Sample = (string)x.Element("sample"), //cannot read value
Data = (string)x.Element("data") //cannot read value
});
Any ideas?