ImmutableList::Replace<T> Method (IImmutableList<T>^, T, T)
Replaces the first equal element in the list with the specified element.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
public: generic<typename T> [ExtensionAttribute] static IImmutableList<T>^ Replace( IImmutableList<T>^ list, T oldValue, T newValue )
Parameters
- list
-
Type:
System.Collections.Immutable::IImmutableList<T>^
The list to search.
- oldValue
-
Type:
T
The element to replace.
- newValue
-
Type:
T
The element to replace the old element with.
Return Value
Type: System.Collections.Immutable::IImmutableList<T>^The new list -- even if the value being replaced is equal to the new value for that position.
Type Parameters
- T
The type of items in the list.
| Exception | Condition |
|---|---|
| ArgumentException | Thrown when the old value does not exist in the list. |
Show: