Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TextWriter.Synchronized Method (TextWriter)


Creates a thread-safe wrapper around the specified TextWriter.

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

[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true)]
public static TextWriter Synchronized(
	TextWriter writer


Type: System.IO.TextWriter

The TextWriter to synchronize.

Return Value

Type: System.IO.TextWriter

A thread-safe wrapper.

Exception Condition

writer is null.

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.

.NET Framework
Available since 1.1
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft