ImmutableList<T>.Replace 方法

定义

重载

Replace(T, T, IEqualityComparer<T>)

将不可变列表中的指定元素替换为新元素。

Replace(T, T)

将不可变列表中的指定元素替换为新元素。

Replace(T, T, IEqualityComparer<T>)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

将不可变列表中的指定元素替换为新元素。

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

参数

oldValue
T

列表中要替换的元素。

newValue
T

用于替换 oldValue 的元素。

equalityComparer
IEqualityComparer<T>

用于检查相等性的比较器。

返回

已替换对象的新列表,或者此列表(如果指定的对象不在此列表中)。

适用于

Replace(T, T)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

将不可变列表中的指定元素替换为新元素。

public:
 System::Collections::Immutable::ImmutableList<T> ^ Replace(T oldValue, T newValue);
public System.Collections.Immutable.ImmutableList<T> Replace (T oldValue, T newValue);
member this.Replace : 'T * 'T -> System.Collections.Immutable.ImmutableList<'T>
Public Function Replace (oldValue As T, newValue As T) As ImmutableList(Of T)

参数

oldValue
T

要替换的元素。

newValue
T

用于替换 oldValue 的元素。

返回

包含被替换元素的新列表,即使该元素等同于旧元素。

例外

不可变列表中不存在 oldValue

适用于