/// <summary> /// Serializes an object to its SOAP state /// </summary> /// <param name="objectToSerialize">The object to serialize.</param> /// <returns> /// XML string representing the object's state /// </returns> /// <remarks> /// For this to work, the provided object must be serializable. /// This method can be used as an extension method. /// </remarks> /// <example> /// using EPS.Utilities; /// // more code /// string state = customer.SerializeToSoapString(); /// // or /// string state = EPS.Utilities.ObjectHelper.SerializeToSoapString(customer); /// </example> public static string SerializeToSoapString(this object objectToSerialize) { return(StreamHelper.ToString(SerializeToSoapStream(objectToSerialize))); }
/// <summary> /// Serializes an object to its XML state /// </summary> /// <param name="objectToSerialize">The object to serialize.</param> /// <returns> /// XML string representing the object's state /// </returns> /// <remarks> /// For this to work, the provided object must be serializable. /// This method can be used as an extension method. /// </remarks> /// <example> /// using EPS.Utilities; /// // more code /// string xml = customer.SerializeToXmlString(); /// // or /// string xml = EPS.Utilities.ObjectHelper.SerializeToXmlString(customer); /// </example> public static string SerializeToXmlString(this object objectToSerialize) => StreamHelper.ToString(SerializeToXmlStream(objectToSerialize));