Stream.Synchronized Method (Stream)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a thread-safe (synchronized) wrapper around the specified Stream object.

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)

[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true)]
public static Stream Synchronized(
	Stream stream
)

Parameters

stream
Type: System.IO.Stream

The Stream object to synchronize.

Return Value

Type: System.IO.Stream

A thread-safe Stream object.

Exception Condition
ArgumentNullException

stream is null.

This method returns a class that wraps the specified Stream object and restricts access to it from multiple threads. All access to the Stream object will be thread safe.

.NET Framework
Available since 2.0
Return to top
Show: