IImmutableList<T>.Replace(T, T, IEqualityComparer<T>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.