Vector.WithElement Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
WithElement(Vector3, Int32, Single) | |
WithElement(Vector2, Int32, Single) | |
WithElement(Vector4, Int32, Single) | |
WithElement<T>(Vector<T>, Int32, T) |
Creates a new Vector<T> with the element at the specified index set to the specified value and the remaining elements set to the same value as that in the given vector. |
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
Parameters
- vector
- Vector3
- index
- Int32
- value
- Single
Returns
Applies to
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
Parameters
- vector
- Vector2
- index
- Int32
- value
- Single
Returns
Applies to
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
Parameters
- vector
- Vector4
- index
- Int32
- value
- Single
Returns
Applies to
WithElement<T>(Vector<T>, Int32, T)
- Source:
- Vector.cs
- Source:
- Vector.cs
Creates a new Vector<T> with the element at the specified index set to the specified value and the remaining elements set to the same value as that in the given vector.
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)
Type Parameters
- T
The type of the elements in the vector.
Parameters
- vector
- Vector<T>
The vector to get the remaining elements from.
- index
- Int32
The index of the element to set.
- value
- T
The value to set the element to.
Returns
A Vector<T> with the value of the element at index
set to value
and the remaining elements set to the same value as that in vector
.
Exceptions
index
was less than zero or greater than the number of elements.
The type of vector
(T
) is not supported.