Breyta

Deila með


Formatter Class

Definition

Caution

BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.

Important

This API is not CLS-compliant.

Provides base functionality for the common language runtime serialization formatters.

public ref class Formatter abstract : System::Runtime::Serialization::IFormatter
[System.CLSCompliant(false)]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[System.Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId="SYSLIB0011", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[System.Serializable]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[System.CLSCompliant(false)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Formatter : System.Runtime.Serialization.IFormatter
[<System.CLSCompliant(false)>]
type Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<System.Obsolete("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId="SYSLIB0011", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<System.Serializable>]
type Formatter = class
    interface IFormatter
[<System.CLSCompliant(false)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Formatter = class
    interface IFormatter
Public MustInherit Class Formatter
Implements IFormatter
Inheritance
Formatter
Attributes
Implements

Remarks

Formatter is the abstract base class for all runtime serialization formatters, and provides some helper methods for implementing the IFormatter interface. The Formatter also manages queuing objects for serialization and generating IDs on a per-object basis.

Notes to Implementers

When you inherit from Formatter, you must override the following members:

Constructors

Formatter()

Initializes a new instance of the Formatter class.

Fields

m_idGenerator

Contains the ObjectIDGenerator used with the current formatter.

m_objectQueue

Contains a Queue of the objects left to serialize.

Properties

Binder

When overridden in a derived class, gets or sets the SerializationBinder used with the current formatter.

Context

When overridden in a derived class, gets or sets the StreamingContext used for the current serialization.

SurrogateSelector

When overridden in a derived class, gets or sets the ISurrogateSelector used with the current formatter.

Methods

Deserialize(Stream)
Obsolete.

When overridden in a derived class, deserializes the stream attached to the formatter when it was created, creating a graph of objects identical to the graph originally serialized into that stream.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNext(Int64)

Returns the next object to serialize, from the formatter's internal work queue.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Schedule(Object)

Schedules an object for later serialization.

Serialize(Stream, Object)
Obsolete.

When overridden in a derived class, serializes the graph of objects with the specified root to the stream already attached to the formatter.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
WriteArray(Object, String, Type)

When overridden in a derived class, writes an array to the stream already attached to the formatter.

WriteBoolean(Boolean, String)

When overridden in a derived class, writes a Boolean value to the stream already attached to the formatter.

WriteByte(Byte, String)

When overridden in a derived class, writes an 8-bit unsigned integer to the stream already attached to the formatter.

WriteChar(Char, String)

When overridden in a derived class, writes a Unicode character to the stream already attached to the formatter.

WriteDateTime(DateTime, String)

When overridden in a derived class, writes a DateTime value to the stream already attached to the formatter.

WriteDecimal(Decimal, String)

When overridden in a derived class, writes a Decimal value to the stream already attached to the formatter.

WriteDouble(Double, String)

When overridden in a derived class, writes a double-precision floating-point number to the stream already attached to the formatter.

WriteInt16(Int16, String)

When overridden in a derived class, writes a 16-bit signed integer to the stream already attached to the formatter.

WriteInt32(Int32, String)

When overridden in a derived class, writes a 32-bit signed integer to the stream.

WriteInt64(Int64, String)

When overridden in a derived class, writes a 64-bit signed integer to the stream.

WriteMember(String, Object)

Inspects the type of data received, and calls the appropriate Write method to perform the write to the stream already attached to the formatter.

WriteObjectRef(Object, String, Type)

When overridden in a derived class, writes an object reference to the stream already attached to the formatter.

WriteSByte(SByte, String)

When overridden in a derived class, writes an 8-bit signed integer to the stream already attached to the formatter.

WriteSingle(Single, String)

When overridden in a derived class, writes a single-precision floating-point number to the stream already attached to the formatter.

WriteTimeSpan(TimeSpan, String)

When overridden in a derived class, writes a TimeSpan value to the stream already attached to the formatter.

WriteUInt16(UInt16, String)

When overridden in a derived class, writes a 16-bit unsigned integer to the stream already attached to the formatter.

WriteUInt32(UInt32, String)

When overridden in a derived class, writes a 32-bit unsigned integer to the stream already attached to the formatter.

WriteUInt64(UInt64, String)

When overridden in a derived class, writes a 64-bit unsigned integer to the stream already attached to the formatter.

WriteValueType(Object, String, Type)

When overridden in a derived class, writes a value of the given type to the stream already attached to the formatter.

Applies to

See also