/// <summary> /// Serialize /// </summary> /// <param name="clientList">List of objects</param> /// <returns>success/fail (bool)</returns> private static bool SaveClientAttributes(List clientList) { try { XmlSerializer serializer = new XmlSerializer(typeof(List)); StreamWriter writer = new StreamWriter((Server.MapPath(string.Empty)) + "\\ClientData.xml"); List ClientList = new List(); serializer.Serialize(writer, clientList); return true; } catch (Exception ex) { return false; } } /// <summary> /// Deserialize /// </summary> /// <returns>List of objects</returns> private static List LoadClientAttributes() { List clientList = new List(); try { XmlSerializer serializer = new XmlSerializer(typeof(List)); FileStream fileStream = new FileStream((Server.MapPath(string.Empty)) + "\\ClientData.xml", FileAccess.Read); clientList = (List)serializer.Deserialize(fileStream); } catch (Exception ex) { //Do nothing } return clientList; }
Monday, November 26, 2007
XML Serialization and Deserialization in .NET
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment