Pass the objects into the following given method it will convert that into xml string format. In this sample XmlSerializer is used to convert the object value into string.
CODE:
private string XmlSerialize(object objValue)
{
XmlSerializer xmlSerializer = new XmlSerializer(objValue.GetType());
StringWriter textWriter = new StringWriter();
xmlSerializer.Serialize(textWriter, objValue);
return textWriter.ToString();
}
{
XmlSerializer xmlSerializer = new XmlSerializer(objValue.GetType());
StringWriter textWriter = new StringWriter();
xmlSerializer.Serialize(textWriter, objValue);
return textWriter.ToString();
}
No comments:
Post a Comment