XmlSerialization Class

Namespace: Artemkv.Transformation.XmlToObject

Provides the extension methods for object serialization.

Syntax

public static class XmlSerialization

Methods

XmlSerialization.LoadFromXml<T, TFilter> Method

Summary

Loads an object from xml string.

	public static T LoadFromXml<T, TFilter>(
		string xmlString,
		MemberFilter<TFilter> filter = null,
		int version = 0,
		IFormatProvider provider = null)
		where T : IXPathSerializable, new()

Type Parameters:

T
The type of the object to deserialize.
TFilter
The type of the object that is used as a member filter.

Parameters:

xmlString
The xml string with the serialized object.
filter
The member filter.
version
The version of the object that should be used when deserializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The deserialized object.

Exceptions:

System.ArgumentNullException
Is thrown if the xmlString parameter is null.
Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.LoadFromXml<T> Method

Summary

Loads an object from xml string.

	public static T LoadFromXml<T>(
		string xmlString,
		int version = 0,
		IFormatProvider provider = null)
		where T : IXPathSerializable, new()

Type Parameters:

T
The type of the object to deserialize.

Parameters:

xmlString
The xml string with the serialized object.
version
The version of the object that should be used when deserializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The deserialized object.

Exceptions:

System.ArgumentNullException
Is thrown if the xmlString parameter is null.
Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.LoadFromXmlDocument<T, TFilter> Method

Summary

Loads an object from xml document.

	public static T LoadFromXml<T, TFilter>(
		string xmlString,
		MemberFilter<TFilter> filter = null,
		int version = 0,
		IFormatProvider provider = null)
		where T : IXPathSerializable, new()

Type Parameters:

T
The type of the object to deserialize.
TFilter
The type of the object that is used as a member filter.

Parameters:

document
The xml document with the serialized object.
filter
The member filter.
version
The version of the object that should be used when deserializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The deserialized object.

Exceptions:

System.ArgumentNullException
Is thrown if the document parameter is null.
Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.LoadFromXmlDocument<T> Method

Summary

Loads an object from xml document.

	public static T LoadFromXmlDocument<T>(
		XDocument document,
		int version = 0,
		IFormatProvider provider = null)
		where T : IXPathSerializable, new()

Type Parameters:

T
The type of the object to deserialize.

Parameters:

document
The xml document with the serialized object.
version
The version of the object that should be used when deserializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The deserialized object.

Exceptions:

System.ArgumentNullException
Is thrown if the document parameter is null.
Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.ToXml Method

Summary

Serializes an object to xml.

	public static string ToXml(
		this IXPathSerializable serializable,
		bool emitTypeInfo = false,
		int version = 0,
		IFormatProvider provider = null)

Parameters:

serializable
The object to serialize.
emitTypeInfo
Specifies whether the type info should be emitted when serializing the object.
version
The version of the object that should be used when serializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The xml string with the serialized object.

Exceptions:

Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.ToXml<TFilter> Method

Summary

Serializes an object to xml.

	public static string ToXml<TFilter>(
		this IXPathSerializable serializable,
		MemberFilter<TFilter> filter = null,
		bool emitTypeInfo = false,
		int version = 0,
		IFormatProvider provider = null)

Parameters:

serializable
The object to serialize.
filter
The member filter.
emitTypeInfo
Specifies whether the type info should be emitted when serializing the object.
version
The version of the object that should be used when serializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The xml string with the serialized object.

Exceptions:

Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.ToXmlDocument Method

Summary

Serializes an object to xml document.

	public static XDocument ToXmlDocument(
		this IXPathSerializable serializable,
		bool emitTypeInfo = false,
		int version = 0,
		IFormatProvider provider = null)

Parameters:

serializable
The object to serialize.
emitTypeInfo
Specifies whether the type info should be emitted when serializing the object.
version
The version of the object that should be used when serializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The xml document with the serialized object.

Exceptions:

Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.

XmlSerialization.ToXmlDocument<TFilter> Method

Summary

Serializes an object to xml document.

	public static XDocument ToXmlDocument<TFilter>(
		this IXPathSerializable serializable,
		MemberFilter<TFilter> filter = null,
		bool emitTypeInfo = false,
		int version = 0,
		IFormatProvider provider = null)

Parameters:

serializable
The object to serialize.
filter
The member filter.
emitTypeInfo
Specifies whether the type info should be emitted when serializing the object.
version
The version of the object that should be used when serializing the object.
provider
An object that supplies culture-specific formatting information.

Returns:

The xml document with the serialized object.

Exceptions:

Artemkv.Transformation.XmlToObject.SerializationException
Is thrown if the serialization cannot be performed.
.

Last edited Nov 20, 2012 at 10:33 PM by artemkv, version 5

Comments

No comments yet.