Editare

Partajați prin


IImmutableList<T>.Replace(T, T, IEqualityComparer<T>) Method

Definition

Returns a new list with the first matching element in the list replaced with the specified element.

public:
 System::Collections::Immutable::IImmutableList<T> ^ Replace(T oldValue, T newValue, System::Collections::Generic::IEqualityComparer<T> ^ equalityComparer);
public System.Collections.Immutable.IImmutableList<T> Replace (T oldValue, T newValue, System.Collections.Generic.IEqualityComparer<T> equalityComparer);
public System.Collections.Immutable.IImmutableList<T> Replace (T oldValue, T newValue, System.Collections.Generic.IEqualityComparer<T>? equalityComparer);
abstract member Replace : 'T * 'T * System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Immutable.IImmutableList<'T>
Public Function Replace (oldValue As T, newValue As T, equalityComparer As IEqualityComparer(Of T)) As IImmutableList(Of T)

Parameters

oldValue
T

The element to be replaced.

newValue
T

The element to replace the first occurrence of oldValue with.

equalityComparer
IEqualityComparer<T>

The equality comparer to use for matching oldValue.

Returns

A new list that contains newValue, even if oldvalue is the same as newValue.

Exceptions

oldValue does not exist in the list.

Applies to