Xml Serialization question
I have a static class.
this static class has a reference to 2 other static classes.
I want to be able to serialize/deserialize this class, so it serializes/deserializes ClassA and ClassB properties/values.
so...
ClassA
Code:
private static SomeClassA theStaticClassA;
private static SomeClassB theStaticClassB;
I would like the properties of these 2 classes to be serialized and deserialized.
how can I do this? (.NET 2.0)
currently I am doing this
Code:
XmlSerializer theXmlSerializer = new XmlSerializer(TheMouseManager.GetType());
StreamWriter theTextWriter = new StreamWriter(theApplicationConfigName);
theXmlSerializer.Serialize(theTextWriter, TheMouseManager);
theTextWriter.Close();
however nothing gets serialized even though there are properties and values set to those properties in this class.
Re: Xml Serialization question
If you have a static class then you cannot serialise it because serialisation is an operation that you perfrom on objects. An object is an instance of a type, and given that you cannot create an instance of a static class you cannot possibly serialise one.
Re: Xml Serialization question
thanks... :)
guess ill manually write the values to xml ;)