Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ImmutableList::Replace<T> Method (IImmutableList<T>^, T, T)

 

Replaces the first equal element in the list with the specified element.

Namespace:   System.Collections.Immutable
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.

Return to top
Show:
© 2017 Microsoft