System.IO.TextWriter.Synchronized Method

Creates a thread-safe wrapper around the specified TextWriter.

Syntax

public static TextWriter Synchronized (TextWriter writer)

Parameters

writer
The TextWriter to synchronize.

Returns

A thread-safe wrapper.

Exceptions

TypeReason
ArgumentNullException writer is null.

Remarks

All write operations to the returned wrapper will be thread safe. You call this method to ensure that only one thread at a time can execute the methods on the System.IO.TextWriter instance that is returned. For more information about synchronization and threading, see Synchronizing Data for Multithreading.

For a list of common I/O tasks, see Common I/O Tasks.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0