Export (0) Print
Expand All

TextReader.Synchronized Method

Creates a thread-safe wrapper around the specified TextReader.

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

public static TextReader Synchronized (
	TextReader reader
)
public static TextReader Synchronized (
	TextReader reader
)
public static function Synchronized (
	reader : TextReader
) : TextReader

Parameters

reader

The TextReader to synchronize.

Return Value

A thread-safe TextReader.

Exception typeCondition

ArgumentNullException

reader is a null reference (Nothing in Visual Basic).

NoteNote

The HostProtectionAttribute attribute applied to this method has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

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.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft