Open sandboxFocus

Class PortableFormatter

A serializer designed to serialize the internal structure of types with support for cyclic object graphs. The PortableFormatter is very similar in function and design to the BinaryFormatter, but is supported on most platforms and does not require full trust. Both formatters have similar usage: SerializableAttribute is replaced by PSerializableAttribute and NonSerializedAttribute by PNonSerializedAttribute.

Inheritance
PortableFormatter
Namespace: PostSharp.Serialization
Assembly: PostSharp.dll
Syntax
public sealed class PortableFormatter
Remarks

The PortableFormatter backs PortableAspectSerializer, the default serialization strategy for aspects annotated with PSerializableAttribute.

Constructors

Name Description
PortableFormatter()

Initializes a new instance of the PortableFormatter class.

PortableFormatter(PortableSerializationBinder, ISerializerFactoryProvider)

Initializes a new instance of the PortableFormatter class.

Properties

Name Description
DefaultBinder

Gets or sets the default PortableSerializationBinder that is used by a PortableFormatter to bind types to/from type names if no PortableSerializationBinder is specified.

MetadataDispenser

When deserializing PostSharp aspects, gets or sets the IMetadataDispenser corresponding to the MetadataEmitter used at build time.

MetadataEmitter

When serializing PostSharp aspects, gets or sets a facility that can be used to serialize metadata (System.Reflection) objects as MSIL, therefore making them transparent to obfuscation.

Methods

Name Description
Deserialize(Stream)

Deserializes a stream.

Serialize(object, Stream)

Serializes an object (and the complete graph whose root is this object) into a Stream.

See Also