I have an application that deserializes an XML file.
I generated a class from an XSD with XSD.EXE
For deserialization I use the following code:
static T LoadFromXMLString<T>(string xmlText)
{
var stringReader = new System.IO.StringReader(xmlText);
var serializer = new XmlSerializer(typeof(T));
return (T)serializer.Deserialize(stringReader);
}
I call it as follows:
var _ProcNFe = LoadFromXMLString<ProcNFe.TNfeProc>(XmlProcNFe);
After that, I use the _ProcNFe
object to write some fields to the database.
However, a doubt has arisen, the XSD I originally used will be changed and consequently the generated class as well.
What would be correct, create a new class from this new version of XSD or change the existing one to conform to the new XSD?