ImmutableArray<T>::Replace Method (T, T, IEqualityComparer<T>^)
Finds the first element in the array equal to the specified value and replaces the value with the specified new value.
Assembly: System.Collections.Immutable (in System.Collections.Immutable.dll)
public:
ImmutableArray<T> Replace(
T oldValue,
T newValue,
IEqualityComparer<T>^ equalityComparer
)
Parameters
- oldValue
-
Type:
T
The value to find and replace in the array.
- newValue
-
Type:
T
The value to replace the oldvalue with.
- equalityComparer
-
Type:
System.Collections.Generic::IEqualityComparer<T>^
The equality comparer to use to compare values.
Return Value
Type: System.Collections.Immutable::ImmutableArray<T>A new array that contains newValue even if the new and old values are the same.
| Exception | Condition |
|---|---|
| ArgumentException | oldValue is not found in the array. |
Show: