简体   繁体   中英

What is the difference between XmlElement Class and XmlElementAttribute Class in C#?

From what I understand I use XmlElement Class to manipulate XML elements with Linq to XML and the XmlElementAttribute Class to mark a member of a given class as an xml element to be serialized.

What am I missing here?

XmlElement is a part of "System.Xml" name space. This class is used for regular XML parsing.

XmlElement is not part of LINQ.

The XML classes related to "LINQ TO XML" are available in "System.Xml.Linq" name space. All LINQ related XML classes are listed in below link https://msdn.microsoft.com/en-us/library/system.xml.linq(v=vs.110).aspx

when it comes to "XmlElementAttribute", this is part of XML serialization. I mean when you are serializing the objects into XML, this class comes in to picture. (System.Xml.Serialization)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM