다음을 통해 공유


PropertyCollection.CompareExchange<T>(Object, T, T) Method

Definition

Compares the entry associated with key for equality with value and, if they are Equals(Object, Object), replaces the entry with value. This is done as a thread-safe/atomic operation.

public T CompareExchange<T> (object key, T value, T comparand);
member this.CompareExchange : obj * 'T * 'T -> 'T
Public Function CompareExchange(Of T) (key As Object, value As T, comparand As T) As T

Type Parameters

T

Parameters

key
Object
value
T
comparand
T

Returns

T

The original entry associated with key.

Remarks

If no value was associated with key, then default(T) is used.

Applies to