Vector.WithElement<T>(Vector<T>, Int32, T) 方法

定義

建立新的 Vector<T>,其中指定索引處的項目設為指定值,且其餘項目設定為與指定向量中值的相同值。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Numerics::Vector<T> WithElement(System::Numerics::Vector<T> vector, int index, T value);
public static System.Numerics.Vector<T> WithElement<T> (this System.Numerics.Vector<T> vector, int index, T value);
static member WithElement : System.Numerics.Vector<'T> * int * 'T -> System.Numerics.Vector<'T>
<Extension()>
Public Function WithElement(Of T) (vector As Vector(Of T), index As Integer, value As T) As Vector(Of T)

類型參數

T

向量中專案的型別。

參數

vector
Vector<T>

要從其中取得剩餘項目的向量。

index
Int32

要設定之元素的索引。

value
T

要設定元素的值。

傳回

Vector<T>,其中 index 處的項目值設為 value,且其餘項目則設定為與 vector 中值的相同值。

例外狀況

index 小於零或大於項目的數目。

不支援 vector (T) 的類型。

適用於