Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Compares two 32-bit signed integers for equality and, if they are equal, replaces one of the values.
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Syntax
[MethodImplAttribute]
public static int CompareExchange (
ref intlocation1,
intvalue,
intcomparand
)
Parameters
- location1
The destination value that will be compared with the value of the comparand parameter and will possibly be replaced. - value
The value that will replace the destination value if the compared integers are equal. - comparand
The value that will be compared with the location1 parameter.
Return Value
The original value of the location1 parameter.
Remarks
This is an atomic operation; it cannot be interrupted before it is complete.
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.
See Also
Reference
Interlocked Class
Interlocked Members
System.Threading Namespace