ImmutableInterlocked.Update Method

Definition

Overloads

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

Mutates an immutable array in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

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

Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

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

Mutates an immutable array in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

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

Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

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

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

Mutates an immutable array in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

C#
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);

Type Parameters

T

The type of data in the immutable array.

TArg

The type of argument passed to the transformer.

Parameters

location
ImmutableArray<T>

The immutable array to be changed.

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

A function that produces the new array from the old. This function should be side-effect free, as it may run multiple times when races occur with other threads.

transformerArgument
TArg

The argument to pass to transformer.

Returns

true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.

Applies to

.NET 10 и друге верзије
Производ Верзије
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

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

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

Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

C#
public static bool Update<T,TArg>(ref T location, Func<T,TArg,T> transformer, TArg transformerArgument) where T : class;

Type Parameters

T

The type of data.

TArg

The type of argument passed to the transformer.

Parameters

location
T

The variable or field to be changed, which may be accessed by multiple threads.

transformer
Func<T,TArg,T>

A function that mutates the value. This function should be side-effect free, as it may run multiple times when races occur with other threads.

transformerArgument
TArg

The argument to pass to transformer.

Returns

true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.

Applies to

.NET 10 и друге верзије
Производ Верзије
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0

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

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

Mutates an immutable array in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

C#
public static bool Update<T>(ref System.Collections.Immutable.ImmutableArray<T> location, Func<System.Collections.Immutable.ImmutableArray<T>,System.Collections.Immutable.ImmutableArray<T>> transformer);

Type Parameters

T

The type of data in the immutable array.

Parameters

location
ImmutableArray<T>

The immutable array to be changed.

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

A function that produces the new array from the old. This function should be side-effect free, as it may run multiple times when races occur with other threads.

Returns

true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.

Applies to

.NET 10 и друге верзије
Производ Верзије
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

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

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

Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.

C#
public static bool Update<T>(ref T location, Func<T,T> transformer) where T : class;

Type Parameters

T

The type of data.

Parameters

location
T

The variable or field to be changed, which may be accessed by multiple threads.

transformer
Func<T,T>

A function that mutates the value. This function should be side-effect free, as it may run multiple times when races occur with other threads.

Returns

true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.

Applies to

.NET 10 и друге верзије
Производ Верзије
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0