Quantcast
Channel: Serialize class to XML? - Stack Overflow
Browsing index pages (3 articles)
↧

Serialize class to XML?

I have the follow class and the list that holds it:public class Transport{ public string TransportType { get; set; } public string Mode { get; set; } public class Coordinates { public float ID { get;...

View Article


Answer by Smur for Serialize class to XML?

You need a stream and a XmlSerializer object, here's an example:FileStream fs = new FileStream(@"C:\MyPath", FileMode.OpenOrCreate);xmlSerializer = new...

View Article


Answer by Justin Niessner for Serialize class to XML?

If both of your classes were tagged with the [Serializable] attribute, then saving things to a file should be as simple as:var serializer = new XmlSerializer(typeof(Transport));using(var writer = new...

View Article
Browsing index pages (3 articles)


Latest Images