Hi SivaRamaKrishnaRaju,
Please find the code below which wioll save the serialised xml to C:\ with boolean value also
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
using System.IO;
using System.Xml;
namespace ConsoleApplication2
{
public class Program
{
static void Main(string[] args)
{
abc xobj = new abc();
xobj.x = 5;
xobj.xy = "RCS";
xobj.xb = false;
System.Xml.Serialization.XmlSerializer xmlObj = new System.Xml.Serialization.XmlSerializer(xobj.GetType());
xmlObj.Serialize(Console.Out, xobj);
Console.WriteLine();
Console.ReadLine();
TextWriter writer = new StreamWriter(@"C:\\a.xml");
xmlObj.Serialize(writer, xobj);
writer.Close();
}
}
public class abc
{
public int x
{
get;
set;
}
public string xy
{
get;
set;
}
public bool xb
{
get;
set;
}
}
}
Output :
="1.0"="utf-8"
- <abc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<x>5</x>
<xy>RCS</xy>
<xb>false</xb>
</abc>
Please dont forget to vote if this helps you