Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could implement <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx" rel="nofollow noreferrer">IXMLSerializable</a> and determine what you want to be serialized. <a href="http://www.codeproject.com/KB/cs/objserial.aspx" rel="nofollow noreferrer">Here</a> is an example of Object serialization. Check out <a href="https://stackoverflow.com/questions/279534/proper-way-to-implement-ixmlserializable">this</a> SO post about the proper way to implement IXMLSerializable. <a href="http://www.codeproject.com/KB/XML/IXmlSerializable.aspx?msg=3057342" rel="nofollow noreferrer">Here</a> is an example of IXMLSerializable using for some collections.</p> <p>It would look something like this:</p> <pre><code>using System; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; namespace ConsoleApplicationCSharp { public class ObjectToSerialize : IXmlSerializable { public string Value1; public string Value2; public string Value3; public string ValueToSerialize; public string Value4; public string Value5; public ObjectToSerialize() { } public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteElementString("Val", ValueToSerialize); } public void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToContent() == XmlNodeType.Element &amp;&amp; reader.LocalName == "Event") { ValueToSerialize = reader["Val"]; reader.Read(); } } public XmlSchema GetSchema() { return (null); } public static void Main(string[] args) { ObjectToSerialize t = new ObjectToSerialize(); t. ValueToSerialize= "Hello"; System.Xml.Serialization.XmlSerializer x = new XmlSerializer(typeof(ObjectToSerialize)); x.Serialize(Console.Out, t); return; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload