[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Indicates that a class can be serialized. This class cannot be inherited.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
Apply the attribute to a type to indicate that instances of this type can be serialized. The common language runtime throws if any type in the graph of objects being serialized does not have the attribute applied.
Apply the attribute even if the class also implements the interface to control the serialization process.
When you apply the attribute to a type, all private and public fields are serialized by default. You can control serialization more granularly by implementing the interface to override the serialization process.
Or you can exclude fields from serialization by applying the NonSerializedAttribute attribute to the field. If a field of a serializable type contains a pointer, a handle, or some other data structure that is specific to a particular environment, and cannot be meaningfully reconstituted in a different environment, then you might want to apply the NonSerializedAttribute attribute to that field.