Example #1
0
 static public String SerializeObject(Object pObject, System.Type objectType)
 {
     try
     {
         String        XmlizedString = null;
         MemoryStream  memoryStream  = new MemoryStream();
         XmlSerializer xs            = new XmlSerializer(objectType);
         XmlTextWriter XmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
         xs.Serialize(XmlTextWriter, pObject);
         memoryStream  = (MemoryStream)XmlTextWriter.BaseStream;
         XmlizedString = CommonLogic.UTF8ByteArrayToString(memoryStream.ToArray());
         return(XmlizedString);
     }
     catch (Exception ex)
     {
         return(CommonLogic.GetExceptionDetail(ex, "\n"));
     }
 }