StreamingContext Structure

Describes the source and destination of a given serialized stream, and provides an additional caller-defined context.

Namespace:  System.Runtime.Serialization
Assembly:  mscorlib (in mscorlib.dll)

[SerializableAttribute]
[ComVisibleAttribute(true)]
public value class StreamingContext

The StreamingContext type exposes the following members.

  NameDescription
Public methodStreamingContext(StreamingContextStates)Initializes a new instance of the StreamingContext class with a given context state.
Public methodStreamingContext(StreamingContextStates, Object)Initializes a new instance of the StreamingContext class with a given context state, and some additional information.
Top

  NameDescription
Public propertyContextGets context specified as part of the additional context.
Public propertyStateGets the source or destination of the transmitted data.
Top

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsEqualsDetermines whether two StreamingContext instances contain the same values. (Overrides ValueType::Equals(Object).)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetHashCodeReturns a hash code of this object. (Overrides ValueType::GetHashCode().)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)
Top

Indicates the source or destination of the bits that the formatter uses. Classes with surrogates or that implement ISerializable can serialize or ignore fields and values based on the information stored in the streaming context. For example, a window handle is still valid if the State property is set to System.Runtime.Serialization.StreamingContextStates.CrossProcess.

The following code example demonstrates the StreamingContext structure.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft