Vector.WithElement 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
WithElement(Vector3, Int32, Single) | |
WithElement(Vector2, Int32, Single) | |
WithElement(Vector4, Int32, Single) | |
WithElement<T>(Vector<T>, Int32, T) |
建立新的 Vector<T>,其中指定索引處的項目設為指定值,且其餘項目設定為與指定向量中值的相同值。 |
WithElement(Vector3, Int32, Single)
public:
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Vector3 WithElement(System::Numerics::Vector3 vector, int index, float value);
public static System.Numerics.Vector3 WithElement(this System.Numerics.Vector3 vector, int index, float value);
static member WithElement : System.Numerics.Vector3 * int * single -> System.Numerics.Vector3
<Extension()>
Public Function WithElement (vector As Vector3, index As Integer, value As Single) As Vector3
參數
- vector
- Vector3
- index
- Int32
- value
- Single
傳回
適用於
WithElement(Vector2, Int32, Single)
public:
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Vector2 WithElement(System::Numerics::Vector2 vector, int index, float value);
public static System.Numerics.Vector2 WithElement(this System.Numerics.Vector2 vector, int index, float value);
static member WithElement : System.Numerics.Vector2 * int * single -> System.Numerics.Vector2
<Extension()>
Public Function WithElement (vector As Vector2, index As Integer, value As Single) As Vector2
參數
- vector
- Vector2
- index
- Int32
- value
- Single
傳回
適用於
WithElement(Vector4, Int32, Single)
public:
[System::Runtime::CompilerServices::Extension]
static System::Numerics::Vector4 WithElement(System::Numerics::Vector4 vector, int index, float value);
public static System.Numerics.Vector4 WithElement(this System.Numerics.Vector4 vector, int index, float value);
static member WithElement : System.Numerics.Vector4 * int * single -> System.Numerics.Vector4
<Extension()>
Public Function WithElement (vector As Vector4, index As Integer, value As Single) As Vector4
參數
- vector
- Vector4
- index
- Int32
- value
- Single
傳回
適用於
WithElement<T>(Vector<T>, Int32, T)
- 來源:
- Vector.cs
- 來源:
- Vector.cs
建立新的 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
) 的類型。