There is a class
class Point { public int X { get; set; } public int Y { get; set; } }
I will serialize it directly into an XML file using the XmlSerializer,
Point point = new Point(); XmlSerializer serializer = new XmlSerializer(typeof(Point)); StreamWriter writer = new StreamWriter(@"point.xml"); serializer.Serialize(writer, point); writer.Close();
How to serialize not directly into a file, but into a string (an object of type string)?