System.Runtime.Serialization.Formatters 4.0.0.0 4.0.1.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 4.2.0.0 4.2.1.0 4.2.2.0 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Attribute [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Struct, Inherited=false)] [<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Struct, Inherited=false)>] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] [<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>] [System.Runtime.InteropServices.ComVisible(true)] [<System.Runtime.InteropServices.ComVisible(true)>] Indicates that a class can be serialized using binary or XML serialization. This class cannot be inherited. attribute to a type to indicate that instances of this type can be serialized using binary or XML serialization. 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 binary serialization process. When you apply the attribute to a type, all private and public fields are serialized by default. You can control binary serialization more granularly by implementing the interface to override the serialization process. Or you can exclude fields from serialization by applying the attribute to the field. If a field of a binary-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 attribute to that field. For more information about using attributes, see [Attributes](/dotnet/standard/attributes/). For more information about binary serialization, see . > [!NOTE] > This attribute does not apply to JSON serialization using . ## Examples The following example demonstrates SOAP serialization of an object that's marked with the attribute. :::code language="csharp" source="~/snippets/csharp/System/NonSerializedAttribute/Overview/s.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/NonSerializedAttribute/Overview/s.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/NonSerializedAttribute/Overview/s.vb" id="Snippet1"::: ]]> Extending Metadata Using Attributes XML and SOAP Serialization Constructor System.Runtime.Serialization.Formatters 4.0.0.0 4.0.1.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 4.2.0.0 4.2.1.0 4.2.2.0 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 Initializes a new instance of the class. To be added.