NET - Explain how to use XML to Serialize an object.

Explain how to use XML to Serialize an object

1. Use the namespace “System.Xml.Serialization”.
2. Create a class whose object is to be serialized
3. Create an object of the class for example
Class1 c = new Class1();

4. Set the properties of the Class1 using the object c.
- c.name=”abc”;
-. c.age=10;

5. Create an instance of XmlSearializer
XmlSerializer x = new XmlSerializer(c.GetType());
TextWriter txtWrite = new StreamWriter( @"c:\test.xml" );

6. Use the xmlserializer instance to serialize the object to xml
x.Serialize(txtWrite,c);

7. Execute the project to verify
NET - Explain how to use XML to deserialize an object.
Explain how to use XML to deserialize an object - XmlSerializer srl = new XmlSerializer(typeof(Class1));......
NET - Debug Build vs. Release build in .NET
Debug Build vs. Release build in .NET - In Debug mode, You can use the development environment's integrated debugging functions.......
NET - What is Code Access Security? Describe the purpose of CAS.
What is Code Access Security? Describe the purpose of CAS - Code access security is a mechanism to help protect computer systems from malicious code......
Post your comment