ImmutableArray<T>.IImmutableList<T>.Replace 方法

定义

查找数组中与指定值相等的第一个元素,并将该值替换为指定的新值。

 virtual System::Collections::Immutable::IImmutableList<T> ^ System.Collections.Immutable.IImmutableList<T>.Replace(T oldValue, T newValue, System::Collections::Generic::IEqualityComparer<T> ^ equalityComparer) = System::Collections::Immutable::IImmutableList<T>::Replace;
System.Collections.Immutable.IImmutableList<T> IImmutableList<T>.Replace (T oldValue, T newValue, System.Collections.Generic.IEqualityComparer<T> equalityComparer);
abstract member System.Collections.Immutable.IImmutableList<T>.Replace : 'T * 'T * System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Immutable.IImmutableList<'T>
override this.System.Collections.Immutable.IImmutableList<T>.Replace : 'T * 'T * System.Collections.Generic.IEqualityComparer<'T> -> System.Collections.Immutable.IImmutableList<'T>
Function Replace (oldValue As T, newValue As T, equalityComparer As IEqualityComparer(Of T)) As IImmutableList(Of T) Implements IImmutableList(Of T).Replace

参数

oldValue
T

要在数组中查找并替换的值。

newValue
T

要替换为 oldvalue 的值。

equalityComparer
IEqualityComparer<T>

用于比较值的相等性比较器。

返回

一个新数组,即使新值和旧值相同,该数组也包含 newValue

实现

例外

在数组中找不到 oldValue

注解

此成员是显式接口成员的实现。 它只能在 ImmutableArray<T> 实例被强制转换为 IImmutableList<T> 接口时使用。

适用于