NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Interlocked.CompareExchange (Int32, Int32, Int32)

Compares two integer values for equality and replaces the destination value if they are equal.

[Visual Basic]
Overloads Public Shared Function CompareExchange( _
   ByRef location1 As Integer, _
   ByVal value As Integer, _
   ByVal comparand As Integer _
) As Integer
[C#]
public static int CompareExchange(
   ref int location1,
   int value,
   int comparand
);
[C++]
public: static int CompareExchange(
   int** location1,
   int value,
   int comparand
);
[JScript]
public static function CompareExchange(
   location1 : int,
   value : int,
   comparand : int
) : int;

Parameters

location1
A destination value that will be compared and possibly replaced.
value
The value that will replace the destination value if the comparison results in equality.
comparand
The value with which the destination value will be compared.

Return Value

The original destination value.

Remarks

If comparand and location1 are equal, then a value (value) is stored in the destination. Otherwise, no operation is performed. The compare and exchange operations are performed in an atomic operation.

See Also

Interlocked Class | Interlocked Members | System.Threading Namespace | Interlocked.CompareExchange Overload List