Serialize Method
Code: Select all
public static string SerializeToString(object obj)
{
try
{
XmlSerializer xmlSerializer = new XmlSerializer(obj.GetType());
using (StringWriter stringWriter = new StringWriter())
{
xmlSerializer.Serialize(stringWriter, obj);
return stringWriter.ToString();
}
}
catch (Exception ex)
{
log.Error("Error Serialising object to string", ex);
return string.Empty;
}
}
There was an error reflecting type 'Vintasoft.Imaging.Annotation.Comments.AnnotationComment'.
To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. Vintasoft.Imaging.Annotation.Comments.CommentCollection does not implement Add(System.Object).