Interface IObjectSerializer

Defines a service responsible for serializing objects so they can be passed to and from the UI.

Namespace: EPiServer.Framework.Serialization
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
public interface IObjectSerializer
Remarks

This serializer is exclusively intended to be used when serializing objects for the Episerver user interface. Usage beyond this scope can have unintended side effects and is not supported.

Properties

HandledContentTypes

Gets a list of all content types that are handled by this IObjectSerializer.

Declaration
IEnumerable<string> HandledContentTypes { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.String>

Methods

Deserialize(TextReader, Type)

Deserializes a string passed from the UI using the specified reader.

Declaration
object Deserialize(TextReader reader, Type objectType)
Parameters
Type Name Description
System.IO.TextReader reader

A reader provided the serialized data.

System.Type objectType

The type of the object to deserialize.

Returns
Type Description
System.Object

The deserialized object.

Deserialize<T>(TextReader)

Deserializes a string passed from the UI using the specified reader.

Declaration
T Deserialize<T>(TextReader reader)
Parameters
Type Name Description
System.IO.TextReader reader

A reader provided the serialized data.

Returns
Type Description
T

The deserialized object.

Type Parameters
Name Description
T

The type of object to deserialize.

Serialize(TextWriter, Object)

Serializes an object to be passed to the UI using the specified text writer.

Declaration
void Serialize(TextWriter textWriter, object value)
Parameters
Type Name Description
System.IO.TextWriter textWriter

The text writer to where the serialized data is written.

System.Object value

The object that should be serialized.

Extension Methods