英語で読む 編集

次の方法で共有


Vector<T> Constructors

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.

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<byte> values);

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10

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);

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10

Vector<T>(Span<T>)

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

Constructs a vector from the given Span<T>.

[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public Vector(Span<T> values);
public Vector(Span<T> values);

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.

Attributes

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1

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);

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1
UWP 10.0

Vector<T>(T[])

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

Creates a vector from a specified array.

public Vector(T[] values);

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1
UWP 10.0

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(T[] values, int index);

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

.NET 10 およびその他のバージョン
製品 バージョン
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1
UWP 10.0