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
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) where TArg : allows ref struct;
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的自变量。

返回

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

适用于

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

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
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;
public static bool Update<T,TArg>(ref T location, Func<T,TArg,T> transformer, TArg transformerArgument) where T : class where TArg : allows ref struct;
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的自变量。

返回

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

适用于

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

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
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>>

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

返回

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

适用于

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

Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
Source:
ImmutableInterlocked.cs
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>

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

返回

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

适用于