Share via


ImmutableInterlocked.Update 方法

定义

重载

Update<T,TArg>(ImmutableArray<T>, Func<ImmutableArray<T>,TArg,ImmutableArray<T>>, TArg)

通过指定的转换函数,就地使用乐观锁定事务语义改变不可变数组。 可根据需要多次重试转换,以赢取乐观锁定争用。

Update<T,TArg>(T, Func<T,TArg,T>, TArg)

通过指定的转换函数,就地使用乐观锁定事务语义来改变值。 可根据需要多次重试转换,以赢取乐观锁定争用。

Update<T>(ImmutableArray<T>, Func<ImmutableArray<T>,ImmutableArray<T>>)

通过指定的转换函数,就地使用乐观锁定事务语义改变不可变数组。 可根据需要多次重试转换,以赢取乐观锁定争用。

Update<T>(T, Func<T,T>)

通过指定的转换函数,就地使用乐观锁定事务语义来改变值。 可根据需要多次重试转换,以赢取乐观锁定争用。

Update<T,TArg>(ImmutableArray<T>, Func<ImmutableArray<T>,TArg,ImmutableArray<T>>, TArg)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

通过指定的转换函数,就地使用乐观锁定事务语义改变不可变数组。 可根据需要多次重试转换,以赢取乐观锁定争用。

public:
generic <typename T, typename TArg>
 static bool Update(System::Collections::Immutable::ImmutableArray<T> % location, Func<System::Collections::Immutable::ImmutableArray<T>, TArg, System::Collections::Immutable::ImmutableArray<T>> ^ transformer, TArg transformerArgument);
public static bool Update<T,TArg> (ref System.Collections.Immutable.ImmutableArray<T> location, Func<System.Collections.Immutable.ImmutableArray<T>,TArg,System.Collections.Immutable.ImmutableArray<T>> transformer, TArg transformerArgument);
static member Update : ImmutableArray * Func<System.Collections.Immutable.ImmutableArray<'T>, 'Arg, System.Collections.Immutable.ImmutableArray<'T>> * 'Arg -> bool
Public Shared Function Update(Of T, TArg) (ByRef location As ImmutableArray(Of T), transformer As Func(Of ImmutableArray(Of T), TArg, ImmutableArray(Of T)), transformerArgument As TArg) As Boolean

类型参数

T

不可变数组中的数据类型。

TArg

传递给 transformer的参数的类型。

参数

location
ImmutableArray<T>

要更改的不可变数组。

transformer
Func<ImmutableArray<T>,TArg,ImmutableArray<T>>

从旧 生成新数组的函数。 此函数应无副作用,因为它可能会在与其他线程发生争用时多次运行。

transformerArgument
TArg

要传递给 transformer 的参数。

返回

如果位置值是通过应用 transformer 函数的结果而更改,则为 true;如果位置值因上次调用 transformer 返回的现有值而保持不变,则为 false

适用于

Update<T,TArg>(T, Func<T,TArg,T>, TArg)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

通过指定的转换函数,就地使用乐观锁定事务语义来改变值。 可根据需要多次重试转换,以赢取乐观锁定争用。

public:
generic <typename T, typename TArg>
 where T : class static bool Update(T % location, Func<T, TArg, T> ^ transformer, TArg transformerArgument);
public static bool Update<T,TArg> (ref T location, Func<T,TArg,T> transformer, TArg transformerArgument) where T : class;
static member Update : 'T * Func<'T, 'Arg, 'T (requires 'T : null and 'T : null)> * 'Arg -> bool (requires 'T : null)
Public Shared Function Update(Of T As Class, TArg As Class) (ByRef location As T, transformer As Func(Of T, TArg, T), transformerArgument As TArg) As Boolean

类型参数

T

数据类型。

TArg

传递给 transformer的参数的类型。

参数

location
T

要更改的变量或字段,可通过多个线程进行访问。

transformer
Func<T,TArg,T>

可改变值的函数。 此函数应无副作用,因为它可能会在与其他线程发生争用时多次运行。

transformerArgument
TArg

要传递给 transformer 的参数。

返回

如果位置值是通过应用 transformer 函数的结果而更改,则为 true;如果位置值因上次调用 transformer 返回的现有值而保持不变,则为 false

适用于

Update<T>(ImmutableArray<T>, Func<ImmutableArray<T>,ImmutableArray<T>>)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

通过指定的转换函数,就地使用乐观锁定事务语义改变不可变数组。 可根据需要多次重试转换,以赢取乐观锁定争用。

public:
generic <typename T>
 static bool Update(System::Collections::Immutable::ImmutableArray<T> % location, Func<System::Collections::Immutable::ImmutableArray<T>, System::Collections::Immutable::ImmutableArray<T>> ^ transformer);
public static bool Update<T> (ref System.Collections.Immutable.ImmutableArray<T> location, Func<System.Collections.Immutable.ImmutableArray<T>,System.Collections.Immutable.ImmutableArray<T>> transformer);
static member Update : ImmutableArray * Func<System.Collections.Immutable.ImmutableArray<'T>, System.Collections.Immutable.ImmutableArray<'T>> -> bool
Public Shared Function Update(Of T) (ByRef location As ImmutableArray(Of T), transformer As Func(Of ImmutableArray(Of T), ImmutableArray(Of T))) As Boolean

类型参数

T

不可变数组中的数据类型。

参数

location
ImmutableArray<T>

要更改的不可变数组。

transformer
Func<ImmutableArray<T>,ImmutableArray<T>>

从旧 生成新数组的函数。 此函数应无副作用,因为它可能会在与其他线程发生争用时多次运行。

返回

如果位置值是通过应用 transformer 函数的结果而更改,则为 true;如果位置值因上次调用 transformer 返回的现有值而保持不变,则为 false

适用于

Update<T>(T, Func<T,T>)

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs

通过指定的转换函数,就地使用乐观锁定事务语义来改变值。 可根据需要多次重试转换,以赢取乐观锁定争用。

public:
generic <typename T>
 where T : class static bool Update(T % location, Func<T, T> ^ transformer);
public static bool Update<T> (ref T location, Func<T,T> transformer) where T : class;
static member Update : 'T * Func<'T, 'T (requires 'T : null and 'T : null)> -> bool (requires 'T : null)
Public Shared Function Update(Of T As Class) (ByRef location As T, transformer As Func(Of T, T)) As Boolean

类型参数

T

数据类型。

参数

location
T

要更改的变量或字段,可通过多个线程进行访问。

transformer
Func<T,T>

可改变值的函数。 此函数应无副作用,因为它可能会在与其他线程发生争用时多次运行。

返回

如果位置值是通过应用 transformer 函数的结果而更改,则为 true;如果位置值因上次调用 transformer 返回的现有值而保持不变,则为 false

适用于