/// <summary> /// Converts the specified object into a serialized form.</summary> /// <param name="saveType"> /// Type of object to convert.</param> /// <param name="saveObject"> /// Object to be serialized.</param> /// <param name="options"> /// Options.</param> /// <returns> /// The serialized form generated from the object.</returns> public static byte[] Serialize(Type saveType, object saveObject, ClassifyOptions options = null) { var node = Classify.Serialize(saveType, saveObject, DefaultFormat, options); using (var mem = new MemoryStream()) { node.WriteToStream(mem); return(mem.ToArray()); } }
/// <summary> /// Converts the specified object into a serialized form.</summary> /// <param name="saveType"> /// Type of object to convert.</param> /// <param name="saveObject"> /// Object to be serialized.</param> /// <param name="options"> /// Options.</param> /// <param name="format"> /// Implementation of a Classify format. See <see cref="ClassifyXmlFormat"/> for an example.</param> /// <returns> /// The serialized form generated from the object.</returns> public static XElement Serialize(Type saveType, object saveObject, ClassifyOptions options = null, IClassifyFormat <XElement> format = null) { return(Classify.Serialize(saveType, saveObject, format ?? DefaultFormat, options)); }
/// <summary> /// Converts the specified object into a serialized form.</summary> /// <typeparam name="T"> /// Type of object to convert.</typeparam> /// <param name="saveObject"> /// Object to be serialized.</param> /// <param name="options"> /// Options.</param> /// <param name="format"> /// Implementation of a Classify format. See <see cref="ClassifyJsonFormat"/> for an example.</param> /// <returns> /// The serialized form generated from the object.</returns> public static JsonValue Serialize <T>(T saveObject, ClassifyOptions options = null, IClassifyFormat <JsonValue> format = null) { return(Classify.Serialize(saveObject, format ?? DefaultFormat, options)); }