WriteableBitmap.TryLock(Duration) Method

Definition

Attempts to lock the bitmap, waiting for no longer than the specified length of time.

C#
[System.Security.SecurityCritical]
public bool TryLock(System.Windows.Duration timeout);
C#
public bool TryLock(System.Windows.Duration timeout);

Parameters

timeout
Duration

A Duration that represents the length of time to wait. A value of 0 returns immediately. A value of Forever blocks indefinitely.

Returns

true if the lock was acquired; otherwise, false.

Attributes

Exceptions

Remarks

When a lock is acquired, the behavior of the TryLock method is the same as the Lock method.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also