Export (0) Print
Expand All

TextReader.Synchronized Method

Creates a thread-safe wrapper around the specified TextReader.

[Visual Basic]
Public Shared Function Synchronized( _
   ByVal reader As TextReader _
) As TextReader
[C#]
public static TextReader Synchronized(
 TextReader reader
);
[C++]
public: static TextReader* Synchronized(
 TextReader* reader
);
[JScript]
public static function Synchronized(
   reader : TextReader
) : TextReader;

Parameters

reader
The TextReader to synchronize.

Return Value

A thread-safe TextReader.

Exceptions

Exception Type Condition
ArgumentNullException reader is a null reference (Nothing in Visual Basic).

Remarks

The current method returns a class that wraps around the specified TextReader instance and restricts access to it by multiple threads. All reads from the returned wrapper will be thread safe.

The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Create a text file. Writing Text to a File
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

TextReader Class | TextReader Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

Show:
© 2014 Microsoft