This topic has not yet been rated - Rate this topic

Interlocked.CompareExchange Method

Compares two values for equality and, if they are equal, replaces one of the values.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member CompareExchange<T>(T, T, T) Compares two instances of the specified reference type T for equality and, if they are equal, replaces one of them.
Public method Static member CompareExchange(Double, Double, Double) Compares two double-precision floating point numbers for equality and, if they are equal, replaces one of the values.
Public method Static member CompareExchange(Int32, Int32, Int32) Compares two 32-bit signed integers for equality and, if they are equal, replaces one of the values.
Public method Static member CompareExchange(Int64, Int64, Int64) Compares two 64-bit signed integers for equality and, if they are equal, replaces one of the values.
Public method Static member CompareExchange(IntPtr, IntPtr, IntPtr) Compares two platform-specific handles or pointers for equality and, if they are equal, replaces one of them.
Public method Static member CompareExchange(Object, Object, Object) Compares two objects for reference equality and, if they are equal, replaces one of the objects.
Public method Static member CompareExchange(Single, Single, Single) Compares two single-precision floating point numbers for equality and, if they are equal, replaces one of the values.
Top
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
What about enums?
There is a huge hole in this method.  It can't be used with enums.  oops....