Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Runtime.​Serialization.​SerializationInfo
Assembly: System.Runtime
Inheritance: object → SerializationInfo
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
Properties
public
string
AssemblyName
Gets or sets the assembly name of the type to serialize during serialization only.
public
string
FullTypeName
Gets or sets the full name of the <see cref="T:System.Type" /> to serialize.
public
bool
IsAssemblyNameSetExplicit
Gets whether the assembly name has been explicitly set.
public
bool
IsFullTypeNameSetExplicit
Gets whether the full type name has been explicitly set.
public
int
MemberCount
Gets the number of members that have been added to the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
Type
ObjectType
Returns the type of the object to be serialized.
Methods
public
void
AddValue​(string name,
bool value)
name
The name to associate with the value, so it can be deserialized later.
value
The Boolean value to serialize.
Adds a Boolean value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
byte value)
name
The name to associate with the value, so it can be deserialized later.
value
The byte value to serialize.
Adds an 8-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
char value)
name
The name to associate with the value, so it can be deserialized later.
value
The character value to serialize.
Adds a Unicode character value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
DateTime value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see cref="T:System.DateTime" /> value to serialize.
Adds a <see cref="T:System.DateTime" /> value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
decimal value)
name
The name to associate with the value, so it can be deserialized later.
value
The decimal value to serialize.
Adds a decimal value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
double value)
name
The name to associate with the value, so it can be deserialized later.
value
The double value to serialize.
Adds a double-precision floating-point value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
short value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see cref="T:System.Int16" /> value to serialize.
Adds a 16-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
int value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see cref="T:System.Int32" /> value to serialize.
Adds a 32-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
long value)
name
The name to associate with the value, so it can be deserialized later.
value
The Int64 value to serialize.
Adds a 64-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
object value)
name
The name to associate with the value, so it can be deserialized later.
value
The value to be serialized. Any children of this object will automatically be serialized.
Adds the specified object into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store, where it is associated with a specified name.
public
void
AddValue​(string name,
object value,
Type type)
name
The name to associate with the value, so it can be deserialized later.
value
The value to be serialized. Any children of this object will automatically be serialized.
type
The <see cref="T:System.Type" /> to associate with the current object. This parameter must always be the type of the object itself or of one of its base classes.
Adds a value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store, where <paramref name="value" /> is associated with <paramref name="name" /> and is serialized as being of <see cref="T:System.Type" /> <paramref name="type" /> .
public
void
AddValue​(string name,
sbyte value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see langword="Sbyte" /> value to serialize.
Adds an 8-bit signed integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
Single value)
name
The name to associate with the value, so it can be deserialized later.
value
The single value to serialize.
Adds a single-precision floating-point value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
ushort value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see cref="T:System.UInt16" /> value to serialize.
Adds a 16-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
uint value)
name
The name to associate with the value, so it can be deserialized later.
value
The <see cref="T:System.UInt32" /> value to serialize.
Adds a 32-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
AddValue​(string name,
ulong value)
name
The name to associate with the value, so it can be deserialized later.
value
The value to serialize.
Adds a 64-bit unsigned integer value into the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
bool
GetBoolean​(string name)
name
The name associated with the value to retrieve.
Returns The Boolean value associated with <paramref name="name" /> .
Retrieves a Boolean value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
byte
GetByte​(string name)
name
The name associated with the value to retrieve.
Returns The 8-bit unsigned integer associated with <paramref name="name" /> .
Retrieves an 8-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
char
GetChar​(string name)
name
The name associated with the value to retrieve.
Returns The Unicode character associated with <paramref name="name" /> .
Retrieves a Unicode character value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
DateTime
GetDateTime​(string name)
name
The name associated with the value to retrieve.
Returns The <see cref="T:System.DateTime" /> value associated with <paramref name="name" /> .
Retrieves a <see cref="T:System.DateTime" /> value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
decimal
GetDecimal​(string name)
name
The name associated with the value to retrieve.
Returns A decimal value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> .
Retrieves a decimal value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
double
GetDouble​(string name)
name
The name associated with the value to retrieve.
Returns The double-precision floating-point value associated with <paramref name="name" /> .
Retrieves a double-precision floating-point value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
SerializationInfoEnumerator
GetEnumerator​() Returns A <see cref="T:System.Runtime.Serialization.SerializationInfoEnumerator" /> for parsing the name-value pairs contained in the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
Returns a <see cref="T:System.Runtime.Serialization.SerializationInfoEnumerator" /> used to iterate through the name-value pairs in the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
short
GetInt16​(string name)
name
The name associated with the value to retrieve.
Returns The 16-bit signed integer associated with <paramref name="name" /> .
Retrieves a 16-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
int
GetInt32​(string name)
name
The name of the value to retrieve.
Returns The 32-bit signed integer associated with <paramref name="name" /> .
Retrieves a 32-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
long
GetInt64​(string name)
name
The name associated with the value to retrieve.
Returns The 64-bit signed integer associated with <paramref name="name" /> .
Retrieves a 64-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
sbyte
GetSByte​(string name)
name
The name associated with the value to retrieve.
Returns The 8-bit signed integer associated with <paramref name="name" /> .
Retrieves an 8-bit signed integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
Single
GetSingle​(string name)
name
The name of the value to retrieve.
Returns The single-precision floating-point value associated with <paramref name="name" /> .
Retrieves a single-precision floating-point value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
string
GetString​(string name)
name
The name associated with the value to retrieve.
Returns The <see cref="T:System.String" /> associated with <paramref name="name" /> .
Retrieves a <see cref="T:System.String" /> value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
ushort
GetUInt16​(string name)
name
The name associated with the value to retrieve.
Returns The 16-bit unsigned integer associated with <paramref name="name" /> .
Retrieves a 16-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
uint
GetUInt32​(string name)
name
The name associated with the value to retrieve.
Returns The 32-bit unsigned integer associated with <paramref name="name" /> .
Retrieves a 32-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
ulong
GetUInt64​(string name)
name
The name associated with the value to retrieve.
Returns The 64-bit unsigned integer associated with <paramref name="name" /> .
Retrieves a 64-bit unsigned integer value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
object
GetValue​(string name,
Type type)
name
The name associated with the value to retrieve.
type
The <see cref="T:System.Type" /> of the value to retrieve. If the stored value cannot be converted to this type, the system will throw a <see cref="T:System.InvalidCastException" /> .
Returns The object of the specified <see cref="T:System.Type" /> associated with <paramref name="name" /> .
Retrieves a value from the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> store.
public
void
SetType​(Type type)
type
The <see cref="T:System.Type" /> of the object to serialize.
Sets the <see cref="T:System.Type" /> of the object to serialize.
public
bool
Equals​(object obj)
Inherited from object
obj
The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns A string that represents the current object.
Returns a string that represents the current object.