แก้ไข

แชร์ผ่าน


Vector<T> Constructors

Definition

Creates an instance of Vector<T>.

Overloads

Vector<T>(ReadOnlySpan<Byte>)

Constructs a vector from the given read-only span of bytes.

Vector<T>(ReadOnlySpan<T>)

Constructs a vector from the given ReadOnlySpan<T>.

Vector<T>(Span<T>)

Constructs a vector from the given Span<T>.

Vector<T>(T)

Creates a vector whose components are of a specified type.

Vector<T>(T[])

Creates a vector from a specified array.

Vector<T>(T[], Int32)

Creates a vector from a specified array starting at a specified index position.

Remarks

The type T can be any of the following numeric types:

C# keywords Framework Type
sbyte SByte
byte Byte
short Int16
ushort UInt16
int Int32
uint UInt32
long Int64
ulong UInt64
float Single
double Double

Vector<T>(ReadOnlySpan<Byte>)

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Constructs a vector from the given read-only span of bytes.

public:
 Vector(ReadOnlySpan<System::Byte> values);
public Vector (ReadOnlySpan<byte> values);
new System.Numerics.Vector<'T (requires 'T : struct)> : ReadOnlySpan<byte> -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : ReadOnlySpan<byte> -> System.Numerics.Vector<'T>
Public Sub New (values As ReadOnlySpan(Of Byte))

Parameters

values
ReadOnlySpan<Byte>

A read-only span of bytes that contains the values to add to the vector. The span must contain at least Count elements and only the first Count elements are used.

Exceptions

values did not contain at least Count elements.

.NET 5 and later: Type T is not supported.

The length of values is less than sizeof(Vector<T>).

Remarks

Only the first Count elements are added to the vector. The remainders are ignored.

Applies to

Vector<T>(ReadOnlySpan<T>)

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Constructs a vector from the given ReadOnlySpan<T>.

public:
 Vector(ReadOnlySpan<T> values);
public Vector (ReadOnlySpan<T> values);
new System.Numerics.Vector<'T (requires 'T : struct)> : ReadOnlySpan<'T (requires 'T : struct)> -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : ReadOnlySpan<'T> -> System.Numerics.Vector<'T>
Public Sub New (values As ReadOnlySpan(Of T))

Parameters

values
ReadOnlySpan<T>

The values to add to the vector, as a read-only span of objects of type T. The span must contain at least Count elements and only the first Count elements are used.

Exceptions

values did not contain at least Count elements.

.NET 5 and later: Type T is not supported.

The length of values is less than Count.

Remarks

Only the first Count elements are added to the vector. The remainders are ignored.

Applies to

Vector<T>(Span<T>)

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Constructs a vector from the given Span<T>.

public:
 Vector(Span<T> values);
public Vector (Span<T> values);
new System.Numerics.Vector<'T (requires 'T : struct)> : Span<'T (requires 'T : struct)> -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : Span<'T> -> System.Numerics.Vector<'T>
Public Sub New (values As Span(Of T))

Parameters

values
Span<T>

The values to add to the vector, as a span of objects of type T. The span must contain at least Count elements and only the first Count elements are used.

Exceptions

values did not contain at least Count elements.

.NET 5 and later: Type T is not supported.

The length of values is less than Count.

Remarks

Only the first Count elements are added to the vector. The remainders are ignored.

Applies to

Vector<T>(T)

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Creates a vector whose components are of a specified type.

public:
 Vector(T value);
public Vector (T value);
new System.Numerics.Vector<'T (requires 'T : struct)> : 'T -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : 'T -> System.Numerics.Vector<'T>
Public Sub New (value As T)

Parameters

value
T

The numeric type that defines the type of the components in the vector.

Exceptions

.NET 5 and later: Type T is not supported.

Applies to

Vector<T>(T[])

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Creates a vector from a specified array.

public:
 Vector(cli::array <T> ^ values);
public Vector (T[] values);
new System.Numerics.Vector<'T (requires 'T : struct)> : 'T[] -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : 'T[] -> System.Numerics.Vector<'T>
Public Sub New (values As T())

Parameters

values
T[]

The values to add to the vector, as an array of objects of type T. The array must contain at least Count elements and only the first Count elements are used.

Exceptions

values is null.

.NET 5 and later: Type T is not supported.

values is null.

The length of values is less than Count.

Remarks

Only the first Count elements are added to the vector. The remainders are ignored.

Applies to

Vector<T>(T[], Int32)

Source:
Vector_1.cs
Source:
Vector_1.cs
Source:
Vector_1.cs

Creates a vector from a specified array starting at a specified index position.

public:
 Vector(cli::array <T> ^ values, int index);
public Vector (T[] values, int index);
new System.Numerics.Vector<'T (requires 'T : struct)> : 'T[] * int -> System.Numerics.Vector<'T (requires 'T : struct)>
new System.Numerics.Vector<'T> : 'T[] * int -> System.Numerics.Vector<'T>
Public Sub New (values As T(), index As Integer)

Parameters

values
T[]

The values to add to the vector, as an array of objects of type T. The array must contain at least Count elements from the specified index and only the first Count elements are used.

index
Int32

The starting index position from which to create the vector.

Exceptions

values is null.

index is less than zero.

-or-

The length of values minus index is less than Count.

.NET 5 and later: Type T is not supported.

values is null.

The length of values, starting from index, is less than Count.

Remarks

Only the first Count elements are added to the vector. The remainders are ignored.

Applies to