Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SemaphoreSlim Constructor (Int32, Int32)

.NET Framework 4.6 and 4.5

Initializes a new instance of the SemaphoreSlim class, specifying the initial and maximum number of requests that can be granted concurrently.

Namespace:  System.Threading
Assemblies:   mscorlib (in mscorlib.dll)
  System.Threading (in System.Threading.dll)

public SemaphoreSlim(
	int initialCount,
	int maxCount
)

Parameters

initialCount
Type: System.Int32

The initial number of requests for the semaphore that can be granted concurrently.

maxCount
Type: System.Int32

The maximum number of requests for the semaphore that can be granted concurrently.

ExceptionCondition
ArgumentOutOfRangeException

initialCount is less than 0, or initialCount is greater than maxCount, or maxCount is equal to or less than 0.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft