Reputation: 666
Normally I do XML Serialization using an entire method that goes somewhat like this
XmlSerializer seralizer = new XmlSerializer(typeof(Method));
StringWriter strWriter = new StringWriter();
XmlTextWriter TextWriter = new XmlTextWriter(strWriter);
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
seralizer.Serialize(TextWriter, Method_Name, ns);
And Deserialization that comes after that goes something like this
XmlSerializer Serializer = new XmlSerializer(typeof(Method_Name), XmlRoot);
XmlNodeReader Reader = new XmlNodeReader(XmlStringDoc.DocumentElement);
objUpdateHotelAllotment = (Method_Name)Serializer.Deserialize(Reader);
Is there any way that these two processes can be carried out using threads, so that when deserialization is being carried out for the first XML, serialization can begin on the second XML ? Use the above codes in thread to illustrate; it's much appreciated.
Upvotes: 0
Views: 511
Reputation: 151604
Thread safety is no issue if each thread gets its own new XmlSerializer()
. So yes, you can just do that.
Upvotes: 1