TextWriter.Synchronized(TextWriter) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a thread-safe wrapper around the specified TextWriter
.
public:
static System::IO::TextWriter ^ Synchronized(System::IO::TextWriter ^ writer);
public static System.IO.TextWriter Synchronized (System.IO.TextWriter writer);
static member Synchronized : System.IO.TextWriter -> System.IO.TextWriter
Public Shared Function Synchronized (writer As TextWriter) As TextWriter
Parameters
- writer
- TextWriter
The TextWriter
to synchronize.
Returns
A thread-safe wrapper.
Exceptions
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 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.