Geeks With Blogs

News My Blog has been MOVED to

Michael Freidgeim's OLD Blog My Blog has been MOVED to
I was using XmlSerialize method from a while.

Recently I found that sometimes it's safer to use TryXmlSerialize:

    /// <summary>
    /// Serialize an object into XML
    /// </summary>
    /// <param name="serializableObject">Object that can be serialized</param>
    /// <returns>Serial XML representation</returns>
    public static bool TryXmlSerialize(object objectToSerialize, out string strXml)
        bool bRet=true;
          strXml =XmlSerialize( objectToSerialize);
        catch (Exception exc)
        return bRet;
I've also found useful to specify inside XmlSerialize
writer.Formatting = Formatting.Indented;
Posted on Sunday, March 22, 2009 10:17 AM .Net Framework | Back to top

Comments on this post: TryXmlSerialize function

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Michael Freidgeim | Powered by: