Uredi

Deli z drugimi prek


ImmutableInterlocked Class

Definition

Contains interlocked exchange mechanisms for immutable collections.

NuGet package: System.Collections.Immutable (about immutable collections and how to install)

public ref class ImmutableInterlocked abstract sealed
public static class ImmutableInterlocked
type ImmutableInterlocked = class
Public Class ImmutableInterlocked
Inheritance
ImmutableInterlocked

Methods

AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>, Func<TKey,TValue,TValue>)

Obtains the value from a dictionary after having added it or updated an existing entry.

AddOrUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue, Func<TKey,TValue,TValue>)

Obtains the value from a dictionary after having added it or updated an existing entry.

Enqueue<T>(ImmutableQueue<T>, T)

Atomically enqueues an element to the end of a queue.

GetOrAdd<TKey,TValue,TArg>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TArg,TValue>, TArg)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, Func<TKey,TValue>)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

GetOrAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue)

Gets the value for the specified key from the dictionary, or if the key was not found, adds a new value to the dictionary.

InterlockedCompareExchange<T>(ImmutableArray<T>, ImmutableArray<T>, ImmutableArray<T>)

Compares two immutable arrays for equality and, if they are equal, replaces one of the arrays.

InterlockedExchange<T>(ImmutableArray<T>, ImmutableArray<T>)

Sets an array to the specified array and returns a reference to the original array, as an atomic operation.

InterlockedInitialize<T>(ImmutableArray<T>, ImmutableArray<T>)

Sets an array to the specified array if the array has not been initialized.

Push<T>(ImmutableStack<T>, T)

Pushes a new element onto the stack.

TryAdd<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue)

Adds the specified key and value to the dictionary if the key is not in the dictionary.

TryDequeue<T>(ImmutableQueue<T>, T)

Atomically removes and returns the specified element at the head of the queue, if the queue is not empty.

TryPop<T>(ImmutableStack<T>, T)

Removes an element from the top of the stack, if there is an element to remove.

TryRemove<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue)

Removes the element with the specified key, if the key exists.

TryUpdate<TKey,TValue>(ImmutableDictionary<TKey,TValue>, TKey, TValue, TValue)

Sets the specified key to the specified value if the specified key already is set to a specific value.

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.

Applies to

Thread Safety

This type is thread safe.