Compares two Objects for equality and replaces the destination value if they are equal.
[Visual Basic] Overloads Public Shared Function CompareExchange( _ ByRef location1 As Object, _ ByVal value As Object, _ ByVal comparand As Object _ ) As Object [C#] public static object CompareExchange( ref object location1, object value, object comparand ); [C++] public: static Object* CompareExchange( Object** location1, Object* value, Object* comparand ); [JScript] public static function CompareExchange( location1 : Object, value : Object, comparand : Object ) : Object;
The original destination value.
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.
Interlocked Class | Interlocked Members | System.Threading Namespace | Interlocked.CompareExchange Overload List