To load an object from an XML using XmlSerializer in C#, follow these steps:
Create an instance of XmlSerializer class for your object type.
main.cs64 chars2 lines
Create a StreamReader object to read the XML file content.
main.cs67 chars2 lines
Call the Deserialize method of the XmlSerializer object and cast the result to the type of your object.
main.cs59 chars2 lines
Close the StreamReader object.
main.cs16 chars2 lines
Here's an example of how it can be done:
main.cs527 chars23 linesgistlibby LogSnag