Vector<T> 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 的實例 Vector<T>。
多載
| 名稱 | Description |
|---|---|
| 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>)
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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>)
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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>
將要加入向量的值,作為一個 T只讀的類型為 的物件張成。 張成必須包含至少 Count 元素,且僅使用前幾個 Count 元素。
例外狀況
values 至少不包含 Count 元素。
.NET 5 及以後版本:不支援型別 T 。
的 values 長度小於 Count。
備註
只有前幾個 Count 元素會加入向量。 剩餘的部分則被忽略。
適用於
Vector<T>(Span<T>)
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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)
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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[])
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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)
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- Vector_1.cs
- 來源:
- 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 元素會加入向量。 剩餘的部分則被忽略。