Vector<T> 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建 Vector<T> 的实例。
重载
| 名称 | 说明 |
|---|---|
| Vector<T>(ReadOnlySpan<Byte>) |
从给定的只读字节范围构造向量。 |
| Vector<T>(ReadOnlySpan<T>) |
从给定 ReadOnlySpan<T>的向量构造一个向量。 |
| Vector<T>(Span<T>) |
从给定 Span<T>的向量构造一个向量。 |
| Vector<T>(T) |
创建其组件属于指定类型的向量。 |
| Vector<T>(T[]) |
从指定的数组创建矢量。 |
| Vector<T>(T[], Int32) |
从指定数组创建从指定索引位置开始的向量。 |
注解
该类型 T 可以是以下任何数值类型:
| C# 关键字 | 框架类型 |
|---|---|
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
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
从给定的只读字节范围构造向量。
public:
Vector(ReadOnlySpan<System::Byte> values);
public Vector(ReadOnlySpan<byte> values);
new System.Numerics.Vector<'T> : ReadOnlySpan<byte> -> System.Numerics.Vector<'T>
new System.Numerics.Vector<'T (requires 'T : struct)> : ReadOnlySpan<byte> -> System.Numerics.Vector<'T (requires 'T : struct)>
Public Sub New (values As ReadOnlySpan(Of Byte))
参数
- values
- ReadOnlySpan<Byte>
例外
values 不包含至少 Count 包含元素。
.NET 5 及更高版本:不支持类型 T 。
长度 values 小于 sizeof(Vector<T>)。
注解
仅将第一个 Count 元素添加到向量中。 将忽略余数。
适用于
Vector<T>(ReadOnlySpan<T>)
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
从给定 ReadOnlySpan<T>的向量构造一个向量。
public:
Vector(ReadOnlySpan<T> values);
public Vector(ReadOnlySpan<T> values);
new System.Numerics.Vector<'T> : ReadOnlySpan<'T> -> System.Numerics.Vector<'T>
new System.Numerics.Vector<'T (requires 'T : struct)> : ReadOnlySpan<'T (requires 'T : struct)> -> System.Numerics.Vector<'T (requires 'T : struct)>
Public Sub New (values As ReadOnlySpan(Of T))
参数
- values
- ReadOnlySpan<T>
例外
values 不包含至少 Count 包含元素。
.NET 5 及更高版本:不支持类型 T 。
长度 values 小于 Count。
注解
仅将第一个 Count 元素添加到向量中。 将忽略余数。
适用于
Vector<T>(Span<T>)
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
从给定 Span<T>的向量构造一个向量。
public:
Vector(Span<T> values);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public Vector(Span<T> values);
public Vector(Span<T> values);
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
new System.Numerics.Vector<'T> : Span<'T> -> System.Numerics.Vector<'T>
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))
参数
- 属性
例外
values 不包含至少 Count 包含元素。
.NET 5 及更高版本:不支持类型 T 。
长度 values 小于 Count。
注解
仅将第一个 Count 元素添加到向量中。 将忽略余数。
适用于
Vector<T>(T)
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
创建其组件属于指定类型的向量。
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)
参数
- value
- T
定义向量中组件类型的数值类型。
例外
.NET 5 及更高版本:不支持类型 T 。
适用于
Vector<T>(T[])
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
从指定的数组创建矢量。
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())
参数
例外
values 是 null。
.NET 5 及更高版本:不支持类型 T 。
values 是 null。
长度 values 小于 Count。
注解
仅将第一个 Count 元素添加到向量中。 将忽略余数。
适用于
Vector<T>(T[], Int32)
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
- Source:
- Vector_1.cs
从指定数组创建从指定索引位置开始的向量。
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)
参数
- index
- Int32
从中创建向量的起始索引位置。
例外
values 是 null。
.NET 5 及更高版本:不支持类型 T 。
values 是 null。
从values其开始的长度index小于Count。
注解
仅将第一个 Count 元素添加到向量中。 将忽略余数。