serialsied and deserialsed DATA Of c# in Xml

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Serialization; using System.Xml; using System.IO; namespace dilip { class XmlSerialiserDesrialser { } public static class SerialiserDeserialser { /// <summary> /// Xml Serialize From Object /// </summary> public static string XmlSerialize<T>(this T objectToSerialize) { XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter); xmlWriter.Formatting = Formatting.Indented; xmlSerializer.Serialize(xmlWriter, objectToSerialize); return stringWriter.ToString(); } /// <summary> /// Deserialize From Xml /// </summary> public static T DeserializeFromXml<T>(string xml) { T result; XmlSerializer ser = new XmlSerializer(typeof(T)); using (TextReader tr = new StringReader(xml)) { result = (T)ser.Deserialize(tr); } return result; } } }
serialsied and deserialsed DATA Of c# in Xml

1 Response

return Utilities.XmlSerialize<Login>(objLoginResponse);

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.