ObjectXMLSerializer<(Of <(<'T>)>)>..::..SaveToString Method
Serializes the specified object to an XML string.
Namespace:
AdvantageCMS.Core.UtilsAssembly: AdvantageCMS.Core (in AdvantageCMS.Core.dll)
Syntax
Parameters
- serializableObject
- Type: T
The object to serialize.
- useNamespace
- Type: Boolean
If true, includes XML namespaces in the output; otherwise, omits them.
Return Value
The XML string representation of the object.Examples
C#
var config = new AppConfig { Name = "MyApp", Version = 2 }; // Serialize without namespaces (default) string xml = ObjectXMLSerializer<AppConfig>.SaveToString(config); // Serialize with namespaces string xmlWithNs = ObjectXMLSerializer<AppConfig>.SaveToString(config, useNamespace: true); // Round-trip back to object AppConfig restored = ObjectXMLSerializer<AppConfig>.LoadFromString(xml);

