Share via


ImmutableInterlocked.InterlockedCompareExchange<T> 方法

定义

比较两个不可变数组是否相等,如果相等,则替换其中一个数组。

public:
generic <typename T>
 static System::Collections::Immutable::ImmutableArray<T> InterlockedCompareExchange(System::Collections::Immutable::ImmutableArray<T> % location, System::Collections::Immutable::ImmutableArray<T> value, System::Collections::Immutable::ImmutableArray<T> comparand);
public static System.Collections.Immutable.ImmutableArray<T> InterlockedCompareExchange<T> (ref System.Collections.Immutable.ImmutableArray<T> location, System.Collections.Immutable.ImmutableArray<T> value, System.Collections.Immutable.ImmutableArray<T> comparand);
static member InterlockedCompareExchange : ImmutableArray * System.Collections.Immutable.ImmutableArray<'T> * System.Collections.Immutable.ImmutableArray<'T> -> System.Collections.Immutable.ImmutableArray<'T>
Public Shared Function InterlockedCompareExchange(Of T) (ByRef location As ImmutableArray(Of T), value As ImmutableArray(Of T), comparand As ImmutableArray(Of T)) As ImmutableArray(Of T)

类型参数

T

数组存储的元素的类型。

参数

location
ImmutableArray<T>

其值将与 comparand 进行比较并且可能被替换的目标。

value
ImmutableArray<T>

比较结果相等时替换目标值的值。

comparand
ImmutableArray<T>

与位于 location 处的值进行比较的值。

返回

location 中的原始值。

适用于