IImmutableList<T>.SetItem(Int32, T) 方法

定义

将列表中位于给定位置的元素替换为指定的元素。Replaces an element in the list at a given position with the specified element.

public:
 System::Collections::Immutable::IImmutableList<T> ^ SetItem(int index, T value);
public System.Collections.Immutable.IImmutableList<T> SetItem (int index, T value);
abstract member SetItem : int * 'T -> System.Collections.Immutable.IImmutableList<'T>
Public Function SetItem (index As Integer, value As T) As IImmutableList(Of T)

参数

index
Int32

要替换的元素在列表中的位置。The position in the list of the element to replace.

value
T

用于替换旧元素的元素。The element to replace the old element with.

返回

IImmutableList<T>

一个新列表,即使位于指定位置的元素与新元素相同,该列表也包含新元素。A new list that contains the new element, even if the element at the specified location is the same as the new element.

适用于