IImmutableList<T>.Replace(T, T, IEqualityComparer<T>) 方法

定义

返回一个新列表,其中的第一个匹配元素已被替换为指定的元素。

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)

参数

oldValue
T

要替换的元素。

newValue
T

要替换为 的第一个匹配项的 oldValue 元素。

equalityComparer
IEqualityComparer<T>

用于匹配 oldValue 的相等性比较器。

返回

一个新列表,即使 oldvaluenewValue 相同,该列表也包含 newValue

例外

列表中不存在 oldValue

适用于