InterlockedCompareExchange Method (Object, Object, Object) |
Compares two objects for reference equality and, if they are equal, replaces one of the objects.
Namespace: System.ThreadingAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static Object CompareExchange(
ref Object location1,
Object value,
Object comparand
)
Parameters
- location1
- Type: SystemObject
The destination object that is compared with comparand and possibly replaced. - value
- Type: SystemObject
The object that replaces the destination object if the comparison results in equality. - comparand
- Type: SystemObject
The object that is compared to the object at location1.
Return Value
Type:
ObjectThe original value in
location1.
Exceptions See Also