Click or drag to resize
InterlockedCompareExchange Method (Int64, Int64, Int64)
Compares two 64-bit signed integers for equality and, if they are equal, replaces one of the values.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static long CompareExchange(
	ref long location1,
	long value,
	long comparand
)

Parameters

location1
Type: SystemInt64
The destination, whose value is compared with comparand and possibly replaced.
value
Type: SystemInt64
The value that replaces the destination value if the comparison results in equality.
comparand
Type: SystemInt64
The value that is compared to the value at location1.

Return Value

Type: Int64
The original value in location1.
Exceptions
ExceptionCondition
NullReferenceExceptionThe address of location1 is a null pointer.
See Also