แก้ไข

แชร์ผ่าน


SerializationInfo Class

Definition

Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.

public ref class SerializationInfo sealed
public sealed class SerializationInfo
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class SerializationInfo
type SerializationInfo = class
[<System.Runtime.InteropServices.ComVisible(true)>]
type SerializationInfo = class
Public NotInheritable Class SerializationInfo
Inheritance
SerializationInfo
Attributes

Remarks

This class is used by objects with custom serialization behavior. The GetObjectData method on either ISerializable or ISerializationSurrogate populates the SerializationInfo store with the name, type, and value of each piece of information it wants to serialize. During deserialization, the appropriate function can extract this information.

Objects are added to the SerializationInfo store at serialization time using the AddValue methods and extracted from the SerializationInfo store at deserialization using the GetValue methods.

For more information about customizing serialization, see Custom Serialization.

Constructors

SerializationInfo(Type, IFormatterConverter, Boolean)
Obsolete.

Initializes a new instance of the SerializationInfo class.

SerializationInfo(Type, IFormatterConverter)
Obsolete.

Creates a new instance of the SerializationInfo class.

Properties

AssemblyName

Gets or sets the assembly name of the type to serialize during serialization only.

FullTypeName

Gets or sets the full name of the Type to serialize.

IsAssemblyNameSetExplicit

Gets whether the assembly name has been explicitly set.

IsFullTypeNameSetExplicit

Gets whether the full type name has been explicitly set.

MemberCount

Gets the number of members that have been added to the SerializationInfo store.

ObjectType

Returns the type of the object to be serialized.

Methods

AddValue(String, Boolean)

Adds a Boolean value into the SerializationInfo store.

AddValue(String, Byte)

Adds an 8-bit unsigned integer value into the SerializationInfo store.

AddValue(String, Char)

Adds a Unicode character value into the SerializationInfo store.

AddValue(String, DateTime)

Adds a DateTime value into the SerializationInfo store.

AddValue(String, Decimal)

Adds a decimal value into the SerializationInfo store.

AddValue(String, Double)

Adds a double-precision floating-point value into the SerializationInfo store.

AddValue(String, Int16)

Adds a 16-bit signed integer value into the SerializationInfo store.

AddValue(String, Int32)

Adds a 32-bit signed integer value into the SerializationInfo store.

AddValue(String, Int64)

Adds a 64-bit signed integer value into the SerializationInfo store.

AddValue(String, Object, Type)

Adds a value into the SerializationInfo store, where value is associated with name and is serialized as being of Typetype.

AddValue(String, Object)

Adds the specified object into the SerializationInfo store, where it is associated with a specified name.

AddValue(String, SByte)

Adds an 8-bit signed integer value into the SerializationInfo store.

AddValue(String, Single)

Adds a single-precision floating-point value into the SerializationInfo store.

AddValue(String, UInt16)

Adds a 16-bit unsigned integer value into the SerializationInfo store.

AddValue(String, UInt32)

Adds a 32-bit unsigned integer value into the SerializationInfo store.

AddValue(String, UInt64)

Adds a 64-bit unsigned integer value into the SerializationInfo store.

Equals(Object)

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

(Inherited from Object)
GetBoolean(String)

Retrieves a Boolean value from the SerializationInfo store.

GetByte(String)

Retrieves an 8-bit unsigned integer value from the SerializationInfo store.

GetChar(String)

Retrieves a Unicode character value from the SerializationInfo store.

GetDateTime(String)

Retrieves a DateTime value from the SerializationInfo store.

GetDecimal(String)

Retrieves a decimal value from the SerializationInfo store.

GetDouble(String)

Retrieves a double-precision floating-point value from the SerializationInfo store.

GetEnumerator()

Returns a SerializationInfoEnumerator used to iterate through the name-value pairs in the SerializationInfo store.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetInt16(String)

Retrieves a 16-bit signed integer value from the SerializationInfo store.

GetInt32(String)

Retrieves a 32-bit signed integer value from the SerializationInfo store.

GetInt64(String)

Retrieves a 64-bit signed integer value from the SerializationInfo store.

GetSByte(String)

Retrieves an 8-bit signed integer value from the SerializationInfo store.

GetSingle(String)

Retrieves a single-precision floating-point value from the SerializationInfo store.

GetString(String)

Retrieves a String value from the SerializationInfo store.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetUInt16(String)

Retrieves a 16-bit unsigned integer value from the SerializationInfo store.

GetUInt32(String)

Retrieves a 32-bit unsigned integer value from the SerializationInfo store.

GetUInt64(String)

Retrieves a 64-bit unsigned integer value from the SerializationInfo store.

GetValue(String, Type)

Retrieves a value from the SerializationInfo store.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
SetType(Type)

Sets the Type of the object to serialize.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also