XmlSerializerSerializeContent(XElement, Object, XmlSerializationOptions) Method

Saves public properties or collection elements of an object given in obj parameter into an already existing XElement object given in parent parameter with provided options.

Definition

Namespace: KGySoft.Serialization.Xml
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public static void SerializeContent(
	XElement parent,
	Object obj,
	XmlSerializationOptions options = XmlSerializationOptions.CompactSerializationOfPrimitiveArrays|XmlSerializationOptions.EscapeNewlineCharacters
)

Parameters

parent  XElement
The parent under that the object will be saved. Its content can be deserialized by DeserializeContent(XElement, Object) method.
obj  Object
The object, which inner content should be serialized. Parameter value must not be .
options  XmlSerializationOptions  (Optional)
Options for serialization. This parameter is optional.
Default value: CompactSerializationOfPrimitiveArrays, EscapeNewlineCharacters

Remarks

If the provided object in obj parameter is a collection, then elements will be serialized, too. If you want to serialize a primitive type, then use the Serialize(Object, XmlSerializationOptions) method.

Exceptions

ArgumentNullExceptionobj and parent must not be .
NotSupportedExceptionSerialization is not supported with provided options
ReflectionExceptionThe object hierarchy to serialize contains circular reference.

See Also