陣列操作
52 個節點
本頁內容 52
作為只讀陣列
函數A read-only view of the array, for handing its contents on without letting the receiver change them.
作為只讀陣列(陣列: T 陣列) -> ReadOnlyCollection<T>
ReadOnlyCollection<T> AsReadOnly(T[] array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to wrap; null throws System.ArgumentNullException. |
返回
| 結果 | ReadOnlyCollection<T> |
備註
The view is not a copy: changes made to the array afterwards show through it.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
二分查詢
函數過載 1/8
二分查詢(陣列: T 陣列, 值: T) -> 整數
int BinarySearch(T[] array, T value)
Finds a value in an array that is already sorted in ascending order, much faster than a front-to-back search on a large array.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The sorted array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for. |
返回
| 結果 | 整數 |
備註
The result is only meaningful if the array is sorted by the same ordering; if several elements equal the value, any one of their positions may be returned. Elements must be comparable, otherwise System.InvalidOperationException is thrown.
過載 2/8
二分查詢(陣列: T 陣列, 值: T, 比較器: IComparer<T>) -> 整數
int BinarySearch(T[] array, T value, IComparer<T> comparer)
Finds a value in an array that is already sorted by the given comparer, much faster than a front-to-back search on a large array.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The sorted array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for. |
| 比較器 | IComparer<T> | — | The ordering the array is sorted by; null uses the elements' default ordering. |
返回
| 結果 | 整數 |
備註
The result is only meaningful if the array is sorted by the same comparer; if several elements equal the value, any one of their positions may be returned.
過載 3/8
二分查詢(陣列: 陣列, 索引: 整數, 長度: 整數, 值: 任意) -> 整數
int BinarySearch(
Array array,
int index,
int length,
object value)Finds a value within a sorted section of a one-dimensional array of any element type, using the elements' default ordering.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index where the section starts. |
| 長度 | 整數 | — | How many elements the section covers. |
| 值 | 任意 | — | The value to look for. |
返回
| 結果 | 整數 |
備註
The section must be sorted in ascending order. A multidimensional array throws System.RankException; a negative index or length throws System.ArgumentOutOfRangeException, and a section running past the end throws System.ArgumentException.
過載 4/8
二分查詢 -> 整數
陣列: T 陣列
索引: 整數
長度: 整數
值: T
比較器: IComparer<T>int BinarySearch(
T[] array,
int index,
int length,
T value,
IComparer<T> comparer)Finds a value within a section of an array, where that section is already sorted by the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index where the section starts. |
| 長度 | 整數 | — | How many elements the section covers. |
| 值 | T | — | The value to look for. |
| 比較器 | IComparer<T> | — | The ordering the section is sorted by; null uses the elements' default ordering. |
返回
| 結果 | 整數 |
備註
A negative index or length throws System.ArgumentOutOfRangeException, and a section running past the end throws System.ArgumentException.
過載 5/8
二分查詢(陣列: T 陣列, 索引: 整數, 長度: 整數, 值: T) -> 整數
int BinarySearch(T[] array, int index, int length, T value)
Finds a value within a section of an array, where that section is already sorted in ascending order.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index where the section starts. |
| 長度 | 整數 | — | How many elements the section covers. |
| 值 | T | — | The value to look for. |
返回
| 結果 | 整數 |
備註
A negative index or length throws System.ArgumentOutOfRangeException, and a section running past the end throws System.ArgumentException.
過載 6/8
二分查詢(陣列: 陣列, 值: 任意, 比較器: IComparer) -> 整數
int BinarySearch(Array array, object value, IComparer comparer)
Finds a value in a sorted one-dimensional array of any element type, using the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The sorted one-dimensional array to search; null throws System.ArgumentNullException. |
| 值 | 任意 | — | The value to look for. |
| 比較器 | IComparer | — | The ordering the array is sorted by; null uses the elements' default ordering. |
返回
| 結果 | 整數 |
備註
The array must be sorted by the same comparer. A multidimensional array throws System.RankException.
過載 7/8
二分查詢(陣列: 陣列, 值: 任意) -> 整數
int BinarySearch(Array array, object value)
Finds a value in a sorted one-dimensional array of any element type, using the elements' default ordering.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The sorted one-dimensional array to search; null throws System.ArgumentNullException. |
| 值 | 任意 | — | The value to look for. |
返回
| 結果 | 整數 |
備註
The array must be sorted in ascending order. A multidimensional array throws System.RankException.
過載 8/8
二分查詢 -> 整數
陣列: 陣列
索引: 整數
長度: 整數
值: 任意
比較器: IComparerint BinarySearch(
Array array,
int index,
int length,
object value,
IComparer comparer)Finds a value within a section of a one-dimensional array of any element type, where that section is sorted by the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index where the section starts. |
| 長度 | 整數 | — | How many elements the section covers. |
| 值 | 任意 | — | The value to look for. |
| 比較器 | IComparer | — | The ordering the section is sorted by; null uses the elements' default ordering. |
返回
| 結果 | 整數 |
備註
A multidimensional array throws System.RankException; a negative index or length throws System.ArgumentOutOfRangeException, and a section running past the end throws System.ArgumentException.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
清空
函數過載 1/2
清空(陣列: 陣列)
void Clear(Array array)
Resets every element of the array, in all dimensions, to its type's default: 0 for numbers, false for booleans, null for text and objects. The array keeps its size.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to clear in place; null throws System.ArgumentNullException. |
過載 2/2
清空(陣列: 陣列, 索引: 整數, 長度: 整數)
void Clear(Array array, int index, int length)
Resets a run of elements to their type's default (0, false or null), leaving the rest of the array untouched.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to clear in place; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index of the first element to reset. |
| 長度 | 整數 | — | How many elements to reset. |
備註
An index below the array's lower bound, a negative length, or a run that goes past the end throws System.IndexOutOfRangeException.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
複製陣列
函數A new array of the same type, shape and contents, so the copy can be changed without affecting the original.
複製陣列(陣列: 陣列) -> 任意
object Clone(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to copy. |
返回
| 結果 | 任意 |
備註
The copy is shallow: for elements that are objects, both arrays refer to the same objects.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
受約束複製
函數Copies a run of elements from one array into another all-or-nothing: if the copy cannot complete, the destination is left exactly as it was.
受約束複製
源陣列: 陣列
源索引: 整數
目標陣列: 陣列
目標索引: 整數
長度: 整數void ConstrainedCopy(
Array sourceArray,
int sourceIndex,
Array destinationArray,
int destinationIndex,
int length)參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源陣列 | 陣列 | — | The array to copy from. |
| 源索引 | 整數 | — | The index in the source where copying starts. |
| 目標陣列 | 陣列 | — | The array to copy into; it must have the same number of dimensions as the source. |
| 目標索引 | 整數 | — | The index in the destination where the first copied element lands. |
| 長度 | 整數 | — | How many elements to copy; a run past the end of either array throws System.ArgumentException. |
備註
Unlike Copy, it does not convert between element types: the source element type must be the same as, or derive from, the destination's, otherwise System.ArrayTypeMismatchException is thrown. The two arrays may be the same array with overlapping ranges.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
全部轉換
函數A new array made by passing each element through a converter, for turning an array of one type into another, such as numbers into labels.
全部轉換 -> TOutput 陣列
陣列: TInput 陣列
轉換器: Converter<TInput, TOutput>TOutput[] ConvertAll(
TInput[] array,
Converter<TInput, TOutput> converter)參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | TInput 陣列 | — | The array to convert; it is left unchanged, and null throws System.ArgumentNullException. |
| 轉換器 | Converter<TInput, TOutput> | — | The function applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | TOutput 陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
複製
函數過載 1/4
複製
源陣列: 陣列
源索引: 整數
目標陣列: 陣列
目標索引: 整數
長度: 整數void Copy(
Array sourceArray,
int sourceIndex,
Array destinationArray,
int destinationIndex,
int length)Copies a run of elements from one position in an array to a position in another (or the same) array, converting element types where a widening or boxing conversion allows.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源陣列 | 陣列 | — | The array to copy from. |
| 源索引 | 整數 | — | The index in the source where copying starts. |
| 目標陣列 | 陣列 | — | The array to copy into; it must have the same number of dimensions as the source, otherwise System.RankException is thrown. |
| 目標索引 | 整數 | — | The index in the destination where the first copied element lands. |
| 長度 | 整數 | — | How many elements to copy; a run past the end of either array throws System.ArgumentException. |
備註
Overlapping ranges within the same array are copied correctly. If an element cannot be converted partway through, the destination may be left partly written; use Constrained Copy when that matters.
過載 2/4
複製(源陣列: 陣列, 目標陣列: 陣列, 長度: 整數)
void Copy(Array sourceArray, Array destinationArray, int length)
Copies the first elements of one array into the start of another, converting element types where a widening or boxing conversion allows.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源陣列 | 陣列 | — | The array to copy from. |
| 目標陣列 | 陣列 | — | The array to copy into; it must have the same number of dimensions as the source, otherwise System.RankException is thrown. |
| 長度 | 整數 | — | How many elements to copy; more than either array holds throws System.ArgumentException. |
過載 3/4
複製
源陣列: 陣列
源索引: 大整數
目標陣列: 陣列
目標索引: 大整數
長度: 大整數void Copy(
Array sourceArray,
long sourceIndex,
Array destinationArray,
long destinationIndex,
long length)Copies a run of elements from one array into another, taking 64-bit positions and count; behaves exactly like the 32-bit Copy.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源陣列 | 陣列 | — | The array to copy from. |
| 源索引 | 大整數 | — | The index in the source where copying starts. |
| 目標陣列 | 陣列 | — | The array to copy into; it must have the same number of dimensions as the source. |
| 目標索引 | 大整數 | — | The index in the destination where the first copied element lands. |
| 長度 | 大整數 | — | How many elements to copy; a run past the end of either array throws System.ArgumentException. |
備註
The values must still fit in the 32-bit range, otherwise System.ArgumentOutOfRangeException is thrown.
過載 4/4
複製(源陣列: 陣列, 目標陣列: 陣列, 長度: 大整數)
void Copy(
Array sourceArray,
Array destinationArray,
long length)Copies the first elements of one array into the start of another, taking a 64-bit count; behaves exactly like the 32-bit Copy.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源陣列 | 陣列 | — | The array to copy from. |
| 目標陣列 | 陣列 | — | The array to copy into; it must have the same number of dimensions as the source. |
| 長度 | 大整數 | — | How many elements to copy; it must fit in the 32-bit range, otherwise System.ArgumentOutOfRangeException is thrown. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
複製到陣列
函數過載 1/2
複製到陣列(源: 陣列, 目標: 陣列, 索引: 大整數)
void CopyTo(Array source, Array destination, long index)
Copies every element of a one-dimensional array into another array, starting at a 64-bit position in the destination.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源 | 陣列 | — | The one-dimensional array to copy from; a multidimensional array throws System.RankException. |
| 目標 | 陣列 | — | The one-dimensional array to copy into; null throws System.ArgumentNullException, and a multidimensional array throws System.ArgumentException. |
| 索引 | 大整數 | — | The position in the destination where the first element lands; it must leave room for every source element, otherwise System.ArgumentException is thrown, and it must fit in the 32-bit range. |
過載 2/2
複製到陣列(源: 陣列, 目標: 陣列, 索引: 整數)
void CopyTo(Array source, Array destination, int index)
Copies every element of a one-dimensional array into another array, starting at the given position in the destination.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源 | 陣列 | — | The one-dimensional array to copy from; a multidimensional array throws System.RankException. |
| 目標 | 陣列 | — | The one-dimensional array to copy into; null throws System.ArgumentNullException, and a multidimensional array throws System.ArgumentException. |
| 索引 | 整數 | — | The position in the destination where the first element lands; negative throws System.ArgumentOutOfRangeException, and too little room for every source element throws System.ArgumentException. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
建立陣列例項
函數過載 1/6
建立陣列例項 -> 陣列
元素型別: Type
長度: 整數陣列
下界: 整數陣列Array CreateInstance(
Type elementType,
int[] lengths,
int[] lowerBounds)A new array of any element type and dimension count, where each dimension can start at an index other than 0 (for example a grid indexed from 1).
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 | 整數陣列 | — | The size of each dimension; its count is the number of dimensions. |
| 下界 | 整數陣列 | — | The starting index of each dimension; it must have as many entries as Lengths, otherwise System.ArgumentException is thrown. |
返回
| 結果 | 陣列 |
備註
Every element starts at its type's default value. Element types that cannot form an array, such as void, throw System.NotSupportedException.
過載 2/6
建立陣列例項(元素型別: Type, 長度: 大整數陣列) -> 陣列
Array CreateInstance(Type elementType, params long[] lengths)
A new zero-based array of any element type, with one dimension per entry in the size list, given as 64-bit sizes.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 | 大整數陣列 | — | The size of each dimension; an empty list throws System.ArgumentException. |
返回
| 結果 | 陣列 |
備註
Every element starts at its type's default value. Each size must fit in the 32-bit range, otherwise System.ArgumentOutOfRangeException is thrown.
過載 3/6
建立陣列例項 -> 陣列
元素型別: Type
長度 1: 整數
長度 2: 整數
長度 3: 整數Array CreateInstance(
Type elementType,
int length1,
int length2,
int length3)A new zero-based three-dimensional array of any element type, for volumes such as voxel grids.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 1 | 整數 | — | The size of the first dimension; negative throws System.ArgumentOutOfRangeException. |
| 長度 2 | 整數 | — | The size of the second dimension; negative throws System.ArgumentOutOfRangeException. |
| 長度 3 | 整數 | — | The size of the third dimension; negative throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 陣列 |
過載 4/6
建立陣列例項(元素型別: Type, 長度 1: 整數, 長度 2: 整數) -> 陣列
Array CreateInstance(Type elementType, int length1, int length2)
A new zero-based two-dimensional array of any element type, for grids and tables.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 1 | 整數 | — | The size of the first dimension (rows); negative throws System.ArgumentOutOfRangeException. |
| 長度 2 | 整數 | — | The size of the second dimension (columns); negative throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 陣列 |
過載 5/6
建立陣列例項(元素型別: Type, 長度: 整數) -> 陣列
Array CreateInstance(Type elementType, int length)
A new zero-based one-dimensional array of an element type chosen at run time.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 | 整數 | — | How many elements the array has; negative throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 陣列 |
過載 6/6
建立陣列例項(元素型別: Type, 長度: 整數陣列) -> 陣列
Array CreateInstance(Type elementType, params int[] lengths)
A new zero-based array of any element type, with one dimension per entry in the size list.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 元素型別 | Type | — | The type of each element. |
| 長度 | 整數陣列 | — | The size of each dimension; an empty list throws System.ArgumentException, and a negative size throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
按陣列型別建立陣列
函數過載 1/3
按陣列型別建立陣列(陣列型別: Type, 長度: 整數陣列) -> 陣列
Array CreateInstanceFromArrayType(
Type arrayType,
params int[] lengths)A new array of the given array type (for example a number grid type), with the given size for each of its dimensions.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列型別 | Type | — | The array type to create, not its element type; a type that is not an array throws System.ArgumentException. |
| 長度 | 整數陣列 | — | The size of each dimension; the count must match the array type's dimension count, otherwise System.ArgumentException is thrown. |
返回
| 結果 | 陣列 |
過載 2/3
按陣列型別建立陣列 -> 陣列
陣列型別: Type
長度: 整數陣列
下界: 整數陣列Array CreateInstanceFromArrayType(
Type arrayType,
int[] lengths,
int[] lowerBounds)A new array of the given array type, with a size and a starting index for each dimension.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列型別 | Type | — | The array type to create, not its element type; a type that is not an array throws System.ArgumentException. |
| 長度 | 整數陣列 | — | The size of each dimension; the count must match the array type's dimension count. |
| 下界 | 整數陣列 | — | The starting index of each dimension; it must have as many entries as Lengths. |
返回
| 結果 | 陣列 |
過載 3/3
按陣列型別建立陣列(陣列型別: Type, 長度: 整數) -> 陣列
Array CreateInstanceFromArrayType(Type arrayType, int length)
A new one-dimensional array of the given array type and length.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列型別 | Type | — | The one-dimensional array type to create, not its element type; a type that is not an array throws System.ArgumentException. |
| 長度 | 整數 | — | How many elements the array has; negative throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
解析逗號分隔的真否陣列
函數此節點沒有文件說明。
解析逗號分隔的真否陣列(值: 文字) -> 真否陣列
bool[] CSVBoolArray(string value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 文字 | — |
返回
| 結果 | 真否陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
解析逗號分隔的數字陣列
函數此節點沒有文件說明。
解析逗號分隔的數字陣列(值: 文字) -> 數字陣列
double[] CSVNumberArray(string value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 文字 | — |
返回
| 結果 | 數字陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
解析逗號分隔的文字名稱
函數此節點沒有文件說明。
解析逗號分隔的文字名稱(值: 文字) -> 文字陣列
string[] CSVStringArray(string value)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 文字 | — |
返回
| 結果 | 文字陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
複製為陣列
函數此節點沒有文件說明。
複製為陣列(源: TType, 數量: 整數) -> TType 陣列
TType[] DuplicateAsArray(TType source, int count = 3)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 源 | TType | — | |
| 數量 | 整數 | 3 |
返回
| 結果 | TType 陣列 |
備註
Prefer strongly typed over object-boxed version of ArrayRoutines.DuplicateAsArray.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
空陣列
函數An array with no elements, for when a result has nothing in it; the same shared instance is returned every time, so it costs no allocation.
空陣列() -> T 陣列
T[] Empty()
返回
| 結果 | T 陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
存在滿足條件的項
函數Whether at least one element passes a test, for questions such as "is any value negative?".
存在滿足條件的項(陣列: T 陣列, 匹配條件: Predicate<T>) -> 真否
bool Exists(T[] array, Predicate<T> match)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to check; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
填充
函數過載 1/2
填充(陣列: T 陣列, 值: T, 起始索引: 整數, 數量: 整數)
void Fill(T[] array, T value, int startIndex, int count)
Overwrites a run of elements with one value, leaving the rest of the array as it was.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to fill in place; null throws System.ArgumentNullException. |
| 值 | T | — | The value written into each element of the run. |
| 起始索引 | 整數 | — | The index of the first element to overwrite. |
| 數量 | 整數 | — | How many elements to overwrite; a run outside the array throws System.ArgumentOutOfRangeException. |
過載 2/2
填充(陣列: T 陣列, 值: T)
void Fill(T[] array, T value)
Overwrites every element of the array with one value, for resetting it to a known state.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to fill in place; null throws System.ArgumentNullException. |
| 值 | T | — | The value written into every element. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
查詢
函數The first element, from the front, that passes a test.
查詢(陣列: T 陣列, 匹配條件: Predicate<T>) -> T
T Find(T[] array, Predicate<T> match)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| Result | T |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
查詢全部
函數Every element that passes a test, as a new array, for filtering an array down to the entries you want.
查詢全部(陣列: T 陣列, 匹配條件: Predicate<T>) -> T 陣列
T[] FindAll(T[] array, Predicate<T> match)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to filter; it is left unchanged, and null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | T 陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
查詢索引
函數過載 1/3
查詢索引 -> 整數
陣列: T 陣列
起始索引: 整數
數量: 整數
匹配條件: Predicate<T>int FindIndex(
T[] array,
int startIndex,
int count,
Predicate<T> match)The position of the first element passing a test within a section of the array, searching forwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 起始索引 | 整數 | — | The index where the search starts. |
| 數量 | 整數 | — | How many elements to examine; a section outside the array throws System.ArgumentOutOfRangeException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
過載 2/3
查詢索引(陣列: T 陣列, 匹配條件: Predicate<T>) -> 整數
int FindIndex(T[] array, Predicate<T> match)
The position of the first element that passes a test, searching from the front.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
過載 3/3
查詢索引 -> 整數
陣列: T 陣列
起始索引: 整數
匹配條件: Predicate<T>int FindIndex(T[] array, int startIndex, Predicate<T> match)
The position of the first element passing a test, searching forwards from a given index to the end.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 起始索引 | 整數 | — | The index where the search starts; outside 0 to the array's length throws System.ArgumentOutOfRangeException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
查詢最後一個
函數The last element, searching from the back, that passes a test.
查詢最後一個(陣列: T 陣列, 匹配條件: Predicate<T>) -> T
T FindLast(T[] array, Predicate<T> match)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| Result | T |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
查詢最後索引
函數過載 1/3
查詢最後索引(陣列: T 陣列, 匹配條件: Predicate<T>) -> 整數
int FindLastIndex(T[] array, Predicate<T> match)
The position of the last element that passes a test, searching from the back.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
過載 2/3
查詢最後索引 -> 整數
陣列: T 陣列
起始索引: 整數
匹配條件: Predicate<T>int FindLastIndex(T[] array, int startIndex, Predicate<T> match)
The position of the last element passing a test, searching backwards from a given index to the start.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 起始索引 | 整數 | — | The index where the backward search starts; outside the array throws System.ArgumentOutOfRangeException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
過載 3/3
查詢最後索引 -> 整數
陣列: T 陣列
起始索引: 整數
數量: 整數
匹配條件: Predicate<T>int FindLastIndex(
T[] array,
int startIndex,
int count,
Predicate<T> match)The position of the last element passing a test within a section that ends at a given index, searching backwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 起始索引 | 整數 | — | The index where the backward search starts, which is the last element of the section. |
| 數量 | 整數 | — | How many elements to examine, going backwards; a section outside the array throws System.ArgumentOutOfRangeException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
摺疊
函數The whole array folded into one value: starting from the seed, function(accumulated, element), left to right.
摺疊 -> 數字
值: 數字陣列
種子: 數字
函數: Func<數字, 數字, 數字>double Fold(
double[] values,
double seed,
Func<double, double, double> function)參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 數字陣列 | — | |
| 種子 | 數字 | — | |
| 函數 | Func<數字, 數字, 數字> | — |
返回
| 結果 | 數字 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
逐項執行
函數Runs an action once for each element, front to back, for side effects such as printing or accumulating.
逐項執行(陣列: T 陣列, 操作: Action<T>)
void ForEach(T[] array, Action<T> action)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to walk; null throws System.ArgumentNullException. |
| 操作 | Action<T> | — | The action run on each element; null throws System.ArgumentNullException. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得列舉器
函數An enumerator that walks every element of the array in order; a multidimensional array is walked with the last dimension changing fastest.
取得列舉器(陣列: 陣列) -> IEnumerator
IEnumerator GetEnumerator(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to walk. |
返回
| 結果 | IEnumerator |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得長度
函數The number of elements along one dimension, for example the number of rows (dimension 0) or columns (dimension 1) of a grid.
取得長度(陣列: 陣列, 維度: 整數) -> 整數
int GetLength(Array array, int dimension)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
| 維度 | 整數 | — | The zero-based dimension to measure; below 0 or not less than the array's dimension count throws System.IndexOutOfRangeException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得大整數長度
函數The number of elements along one dimension, as a 64-bit number.
取得大整數長度(陣列: 陣列, 維度: 整數) -> 大整數
long GetLongLength(Array array, int dimension)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
| 維度 | 整數 | — | The zero-based dimension to measure; below 0 or not less than the array's dimension count throws System.IndexOutOfRangeException. |
返回
| 結果 | 大整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得下界
函數The first valid index along one dimension; 0 for ordinary arrays, other values only for arrays created with explicit lower bounds.
取得下界(陣列: 陣列, 維度: 整數) -> 整數
int GetLowerBound(Array array, int dimension)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
| 維度 | 整數 | — | The zero-based dimension to inspect; below 0 or not less than the array's dimension count throws System.IndexOutOfRangeException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得上界
函數The last valid index along one dimension, inclusive; for an ordinary array this is that dimension's length minus 1, and -1 for an empty dimension.
取得上界(陣列: 陣列, 維度: 整數) -> 整數
int GetUpperBound(Array array, int dimension)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
| 維度 | 整數 | — | The zero-based dimension to inspect; below 0 or not less than the array's dimension count throws System.IndexOutOfRangeException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
取得值
函數過載 1/8
取得值 -> 任意
陣列: 陣列
索引 1: 大整數
索引 2: 大整數
索引 3: 大整數object GetValue(
Array array,
long index1,
long index2,
long index3)Reads the element at a position in a three-dimensional array, given as 64-bit indices.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The three-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 1 | 大整數 | — | The index along the first dimension. |
| 索引 2 | 大整數 | — | The index along the second dimension. |
| 索引 3 | 大整數 | — | The index along the third dimension. |
返回
| 結果 | 任意 |
過載 2/8
取得值(陣列: 陣列, 索引 1: 大整數, 索引 2: 大整數) -> 任意
object GetValue(Array array, long index1, long index2)
Reads the element at a position in a two-dimensional array, given as 64-bit indices.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The two-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 1 | 大整數 | — | The index along the first dimension (row). |
| 索引 2 | 大整數 | — | The index along the second dimension (column). |
返回
| 結果 | 任意 |
過載 3/8
取得值(陣列: 陣列, 索引: 大整數) -> 任意
object GetValue(Array array, long index)
Reads the element at a position in a one-dimensional array, given as a 64-bit index.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 | 大整數 | — | The position of the element. |
返回
| 結果 | 任意 |
過載 4/8
取得值(陣列: 陣列, 索引: 整數) -> 任意
object GetValue(Array array, int index)
Reads the element at a position in a one-dimensional array of any element type.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 | 整數 | — | The position of the element. |
返回
| 結果 | 任意 |
過載 5/8
取得值(陣列: 陣列, 索引 1: 整數, 索引 2: 整數) -> 任意
object GetValue(Array array, int index1, int index2)
Reads the element at a row and column of a two-dimensional array.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The two-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 1 | 整數 | — | The index along the first dimension (row). |
| 索引 2 | 整數 | — | The index along the second dimension (column). |
返回
| 結果 | 任意 |
過載 6/8
取得值 -> 任意
陣列: 陣列
索引 1: 整數
索引 2: 整數
索引 3: 整數object GetValue(Array array, int index1, int index2, int index3)
Reads the element at a position in a three-dimensional array.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The three-dimensional array to read; any other dimension count throws System.ArgumentException. |
| 索引 1 | 整數 | — | The index along the first dimension. |
| 索引 2 | 整數 | — | The index along the second dimension. |
| 索引 3 | 整數 | — | The index along the third dimension. |
返回
| 結果 | 任意 |
過載 7/8
取得值(陣列: 陣列, 索引: 整數陣列) -> 任意
object GetValue(Array array, params int[] indices)
Reads the element at a position given as one index per dimension, for arrays of any dimension count.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to read. |
| 索引 | 整數陣列 | — | One index per dimension; a count different from the array's dimension count throws System.ArgumentException, and null throws System.ArgumentNullException. |
返回
| 結果 | 任意 |
過載 8/8
取得值(陣列: 陣列, 索引: 大整數陣列) -> 任意
object GetValue(Array array, params long[] indices)
Reads the element at a position given as one 64-bit index per dimension, for arrays of any dimension count.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to read. |
| 索引 | 大整數陣列 | — | One index per dimension; a count different from the array's dimension count throws System.ArgumentException, and null throws System.ArgumentNullException. |
返回
| 結果 | 任意 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
項的索引
函數過載 1/6
項的索引 -> 整數
陣列: T 陣列
值: T
起始索引: 整數
數量: 整數int IndexOf(T[] array, T value, int startIndex, int count)
The position of the first element equal to a value within a section of the array, searching forwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the search starts. |
| 數量 | 整數 | — | How many elements to examine; a section outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 2/6
項的索引(陣列: T 陣列, 值: T, 起始索引: 整數) -> 整數
int IndexOf(T[] array, T value, int startIndex)
The position of the first element equal to a value, searching forwards from a given index to the end.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the search starts; outside 0 to the array's length throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 3/6
項的索引(陣列: T 陣列, 值: T) -> 整數
int IndexOf(T[] array, T value)
The position of the first element equal to a value, searching from the front.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
返回
| 結果 | 整數 |
過載 4/6
項的索引(陣列: 陣列, 值: 任意) -> 整數
int IndexOf(Array array, object value)
The position of the first element equal to a value in a one-dimensional array of any element type, searching from the front.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
返回
| 結果 | 整數 |
過載 5/6
項的索引(陣列: 陣列, 值: 任意, 起始索引: 整數) -> 整數
int IndexOf(Array array, object value, int startIndex)
The position of the first element equal to a value in a one-dimensional array of any element type, searching forwards from a given index to the end.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the search starts; outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 6/6
項的索引 -> 整數
陣列: 陣列
值: 任意
起始索引: 整數
數量: 整數int IndexOf(
Array array,
object value,
int startIndex,
int count)The position of the first element equal to a value within a section of a one-dimensional array of any element type, searching forwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the search starts. |
| 數量 | 整數 | — | How many elements to examine; a section outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
初始化
函數Runs the element type's parameterless constructor on every element of an array of value types; for arrays of objects, numbers or other types without such a constructor it does nothing.
初始化(陣列: 陣列)
void Initialize(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to initialise in place. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
是否固定大小
函數Whether the array's size is fixed; always true, since an array cannot grow or shrink in place (Resize makes a new array instead).
是否固定大小(陣列: 陣列) -> 真否
bool IsFixedSize(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
是否只讀
函數Whether the array's elements can be changed; always false for an array, because every array's elements are writable (wrap it with As Read Only for a view that cannot be written through).
是否只讀(陣列: 陣列) -> 真否
bool IsReadOnly(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
是否同步
函數Whether access to the array is thread-safe on its own; always false for an array, so lock on SyncRoot when several threads share one.
是否同步(陣列: 陣列) -> 真否
bool IsSynchronized(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
項的最後索引
函數過載 1/6
項的最後索引 -> 整數
陣列: 陣列
值: 任意
起始索引: 整數
數量: 整數int LastIndexOf(
Array array,
object value,
int startIndex,
int count)The position of the last element equal to a value within a section of a one-dimensional array of any element type that ends at a given index, searching backwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the backward search starts, which is the last element of the section. |
| 數量 | 整數 | — | How many elements to examine, going backwards; a section outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 2/6
項的最後索引 -> 整數
陣列: T 陣列
值: T
起始索引: 整數
數量: 整數int LastIndexOf(T[] array, T value, int startIndex, int count)
The position of the last element equal to a value within a section that ends at a given index, searching backwards.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the backward search starts, which is the last element of the section. |
| 數量 | 整數 | — | How many elements to examine, going backwards; a section outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 3/6
項的最後索引(陣列: T 陣列, 值: T, 起始索引: 整數) -> 整數
int LastIndexOf(T[] array, T value, int startIndex)
The position of the last element equal to a value, searching backwards from a given index to the start.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the backward search starts; outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 4/6
項的最後索引(陣列: T 陣列, 值: T) -> 整數
int LastIndexOf(T[] array, T value)
The position of the last element equal to a value, searching from the back.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to search; null throws System.ArgumentNullException. |
| 值 | T | — | The value to look for, compared by equality. |
返回
| 結果 | 整數 |
過載 5/6
項的最後索引(陣列: 陣列, 值: 任意, 起始索引: 整數) -> 整數
int LastIndexOf(Array array, object value, int startIndex)
The position of the last element equal to a value in a one-dimensional array of any element type, searching backwards from a given index to the start.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
| 起始索引 | 整數 | — | The index where the backward search starts; outside the array throws System.ArgumentOutOfRangeException. |
返回
| 結果 | 整數 |
過載 6/6
項的最後索引(陣列: 陣列, 值: 任意) -> 整數
int LastIndexOf(Array array, object value)
The position of the last element equal to a value in a one-dimensional array of any element type, searching from the back.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to search; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 值 | 任意 | — | The value to look for, compared by equality. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
長度
函數The total number of elements across all dimensions of the array, so a 3 by 4 grid gives 12.
長度(陣列: 陣列) -> 整數
int Length(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to count. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
大整數長度
函數The total number of elements across all dimensions of the array, as a 64-bit number; use it instead of Length when a count could exceed the 32-bit range.
大整數長度(陣列: 陣列) -> 大整數
long LongLength(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to count. |
返回
| 結果 | 大整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
建立陣列
函數此節點沒有文件說明。
建立陣列(數量: 整數) -> TType 陣列
TType[] MakeArray(int count)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 數量 | 整數 | — |
返回
| 結果 | TType 陣列 |
備註
The element type is the node's TType generic argument (a node property since format v1.2).
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
建立真否陣列
函數此節點沒有文件說明。
建立真否陣列(值: 真否陣列) -> 真否陣列
bool[] MakeBoolArray(params bool[] values)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 真否陣列 | — |
返回
| 結果 | 真否陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
建立數字陣列
函數此節點沒有文件說明。
建立數字陣列(值: 數字陣列) -> 數字陣列
double[] MakeNumberArray(params double[] values)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 數字陣列 | — |
返回
| 結果 | 數字陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
建立文字陣列
函數此節點沒有文件說明。
建立文字陣列(值: 文字陣列) -> 文字陣列
string[] MakeStringArray(params string[] values)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 文字陣列 | — |
返回
| 結果 | 文字陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
對映
函數Each element through a function: the array that comes back is the results, in order.
對映(值: 數字陣列, 函數: Func<數字, 數字>) -> 數字陣列
double[] Map(double[] values, Func<double, double> function)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | 數字陣列 | — | |
| 函數 | Func<數字, 數字> | — |
返回
| 結果 | 數字陣列 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
最大長度
函數The largest number of elements any single array can hold on this runtime (2,147,483,591), useful as an upper limit when checking a requested size before allocating.
最大長度() -> 整數
int MaxLength()
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
維數
函數The number of dimensions of the array: 1 for a plain list of values, 2 for a grid, 3 for a volume.
維數(陣列: 陣列) -> 整數
int Rank(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to inspect. |
返回
| 結果 | 整數 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
重複
函數A new array holding the same value in every slot, for when you need a run of identical entries such as a row of zeros or a default label repeated.
重複(值: TType, 數量: 整數) -> TType 陣列
TType[] Replicate(TType value, int count)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 值 | TType | — | The value placed in every slot. |
| 數量 | 整數 | — | How many slots the array has; 0 gives an empty array, and a negative count throws System.OverflowException. |
返回
| 結果 | TType 陣列 |
備註
For a reference type every slot holds the same object, not a copy of it, so changing that object through one slot shows through all of them.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
調整大小
函數Changes an array's length by replacing it with a new array of the new size that keeps the existing elements from the front.
調整大小(陣列: T 陣列, 新大小: 整數)
void Resize(ref T[] array, int newSize)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to resize; on return it refers to the resized array. |
| 新大小 | 整數 | — | The new number of elements; negative throws System.ArgumentOutOfRangeException. |
備註
Growing adds default-valued (0, false or null) elements at the end; shrinking drops the elements past the new length; the same size leaves the array alone. A null array is replaced by a new array of the requested size.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
反轉
函數過載 1/4
反轉(陣列: T 陣列, 索引: 整數, 長度: 整數)
void Reverse(T[] array, int index, int length)
Reverses the order of a run of elements in place, leaving the rest of the array as it was.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to modify; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers; a negative index or length throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
過載 2/4
反轉(陣列: 陣列, 索引: 整數, 長度: 整數)
void Reverse(Array array, int index, int length)
Reverses the order of a run of elements in place in a one-dimensional array of any element type.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to modify; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers; a negative index or length throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException. |
過載 3/4
反轉(陣列: 陣列)
void Reverse(Array array)
Reverses the order of all elements in place in a one-dimensional array of any element type, so the last becomes first.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to modify; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
過載 4/4
反轉(陣列: T 陣列)
void Reverse(T[] array)
Reverses the order of all elements in place, so the last becomes first.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to modify; null throws System.ArgumentNullException. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
設定值
函數過載 1/8
設定值(陣列: 陣列, 值: 任意, 索引 1: 大整數, 索引 2: 大整數)
void SetValue(
Array array,
object value,
long index1,
long index2)Writes a value into a two-dimensional array at a row and column given as 64-bit indices.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The two-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 1 | 大整數 | — | The index along the first dimension (row). |
| 索引 2 | 大整數 | — | The index along the second dimension (column); an index beyond the 32-bit range throws System.ArgumentOutOfRangeException, and one outside its dimension throws System.IndexOutOfRangeException. |
過載 2/8
設定值(陣列: 陣列, 值: 任意, 索引: 大整數)
void SetValue(Array array, object value, long index)
Writes a value into a one-dimensional array at a position given as a 64-bit index.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 | 大整數 | — | The position to write; beyond the 32-bit range throws System.ArgumentOutOfRangeException, and outside the array throws System.IndexOutOfRangeException. |
過載 3/8
設定值(陣列: 陣列, 值: 任意, 索引: 整數陣列)
void SetValue(Array array, object value, params int[] indices)
Writes a value at a position given as one index per dimension, for arrays of any dimension count.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to write. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 | 整數陣列 | — | One index per dimension; a count different from the array's dimension count throws System.ArgumentException, and an index outside its dimension throws System.IndexOutOfRangeException. |
過載 4/8
設定值
陣列: 陣列
值: 任意
索引 1: 整數
索引 2: 整數
索引 3: 整數void SetValue(
Array array,
object value,
int index1,
int index2,
int index3)Writes a value into a three-dimensional array at the given position.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The three-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 1 | 整數 | — | The index along the first dimension. |
| 索引 2 | 整數 | — | The index along the second dimension. |
| 索引 3 | 整數 | — | The index along the third dimension; an index outside its dimension throws System.IndexOutOfRangeException. |
過載 5/8
設定值(陣列: 陣列, 值: 任意, 索引 1: 整數, 索引 2: 整數)
void SetValue(Array array, object value, int index1, int index2)
Writes a value into a two-dimensional array at a row and column.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The two-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 1 | 整數 | — | The index along the first dimension (row). |
| 索引 2 | 整數 | — | The index along the second dimension (column); an index outside its dimension throws System.IndexOutOfRangeException. |
過載 6/8
設定值(陣列: 陣列, 值: 任意, 索引: 整數)
void SetValue(Array array, object value, int index)
Writes a value into a one-dimensional array of any element type at the given position.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 | 整數 | — | The position to write; outside the array throws System.IndexOutOfRangeException. |
過載 7/8
設定值(陣列: 陣列, 值: 任意, 索引: 大整數陣列)
void SetValue(Array array, object value, params long[] indices)
Writes a value at a position given as one 64-bit index per dimension, for arrays of any dimension count.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array to write. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 | 大整數陣列 | — | One index per dimension; a count different from the array's dimension count throws System.ArgumentException, and an index beyond the 32-bit range throws System.ArgumentOutOfRangeException, and one outside its dimension throws System.IndexOutOfRangeException. |
過載 8/8
設定值
陣列: 陣列
值: 任意
索引 1: 大整數
索引 2: 大整數
索引 3: 大整數void SetValue(
Array array,
object value,
long index1,
long index2,
long index3)Writes a value into a three-dimensional array at a position given as 64-bit indices.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The three-dimensional array to write; any other dimension count throws System.ArgumentException. |
| 值 | 任意 | — | The value to store; one that cannot be converted to the element type throws System.InvalidCastException. |
| 索引 1 | 大整數 | — | The index along the first dimension. |
| 索引 2 | 大整數 | — | The index along the second dimension. |
| 索引 3 | 大整數 | — | The index along the third dimension; an index beyond the 32-bit range throws System.ArgumentOutOfRangeException, and one outside its dimension throws System.IndexOutOfRangeException. |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
排序
函數過載 1/17
排序(陣列: T 陣列, 索引: 整數, 長度: 整數, 比較器: IComparer<T>)
void Sort(
T[] array,
int index,
int length,
IComparer<T> comparer)Sorts a run of elements in place using the given comparer, leaving the rest of the array as it was.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to sort; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
| 比較器 | IComparer<T> | — | The ordering to sort by; null uses the elements' default ordering, which throws System.InvalidOperationException if the elements are not comparable. |
備註
The sort is not stable: elements that compare equal may change order. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException.
過載 2/17
排序(鍵: 陣列, 項: 陣列)
void Sort(Array keys, Array items)
Sorts one array of keys in ascending order and rearranges a second array the same way, so each item stays paired with its key; use it to sort names by their scores, for example.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | 陣列 | — | The one-dimensional array of keys to sort by; null throws System.ArgumentNullException. |
| 項 | 陣列 | — | The array rearranged alongside the keys; null sorts only the keys, and an array shorter than the keys throws System.ArgumentException. |
備註
The sort is not stable. Keys that are not comparable throw System.InvalidOperationException; either array being multidimensional throws System.RankException.
過載 3/17
排序(鍵: 陣列, 項: 陣列, 比較器: IComparer)
void Sort(Array keys, Array items, IComparer comparer)
Sorts one array of keys using the given comparer and rearranges a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | 陣列 | — | The one-dimensional array of keys to sort by; null throws System.ArgumentNullException. |
| 項 | 陣列 | — | The array rearranged alongside the keys; null sorts only the keys, and an array shorter than the keys throws System.ArgumentException. |
| 比較器 | IComparer | — | The ordering of the keys; null uses the keys' default ordering. |
備註
The sort is not stable. Either array being multidimensional throws System.RankException.
過載 4/17
排序(鍵: 陣列, 項: 陣列, 索引: 整數, 長度: 整數)
void Sort(Array keys, Array items, int index, int length)
Sorts a run of keys in ascending order and rearranges the matching run of a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | 陣列 | — | The one-dimensional array of keys to sort by; null throws System.ArgumentNullException. |
| 項 | 陣列 | — | The array rearranged alongside the keys; null sorts only the keys. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end of either array throws System.ArgumentException.
過載 5/17
排序
鍵: 陣列
項: 陣列
索引: 整數
長度: 整數
比較器: IComparervoid Sort(
Array keys,
Array items,
int index,
int length,
IComparer comparer)Sorts a run of keys using the given comparer and rearranges the matching run of a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | 陣列 | — | The one-dimensional array of keys to sort by; null throws System.ArgumentNullException. |
| 項 | 陣列 | — | The array rearranged alongside the keys; null sorts only the keys. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
| 比較器 | IComparer | — | The ordering of the keys; null uses the keys' default ordering. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end of either array throws System.ArgumentException.
過載 6/17
排序(陣列: 陣列, 比較器: IComparer)
void Sort(Array array, IComparer comparer)
Sorts a one-dimensional array of any element type in place using the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to sort; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 比較器 | IComparer | — | The ordering to sort by; null uses the elements' default ordering, which throws System.InvalidOperationException if the elements are not comparable. |
備註
The sort is not stable: elements that compare equal may change order.
過載 7/17
排序(陣列: 陣列, 索引: 整數, 長度: 整數)
void Sort(Array array, int index, int length)
Sorts a run of elements of a one-dimensional array of any element type in place, in ascending order.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to sort; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, a run past the end throws System.ArgumentException, and elements that are not comparable throw System.InvalidOperationException.
過載 8/17
排序(陣列: T 陣列, 比較方式: Comparison<T>)
void Sort(T[] array, Comparison<T> comparison)
Sorts the whole array in place using a comparison function, for orderings such as by length or descending.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to sort; null throws System.ArgumentNullException. |
| 比較方式 | Comparison<T> | — | The function that orders two elements; null throws System.ArgumentNullException. |
備註
The comparison returns a negative number when the first argument comes first, 0 when they are equal and a positive number when the second comes first. The sort is not stable.
過載 9/17
排序(陣列: 陣列, 索引: 整數, 長度: 整數, 比較器: IComparer)
void Sort(
Array array,
int index,
int length,
IComparer comparer)Sorts a run of elements of a one-dimensional array of any element type in place, using the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to sort; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
| 比較器 | IComparer | — | The ordering to sort by; null uses the elements' default ordering. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end throws System.ArgumentException.
過載 10/17
排序(陣列: T 陣列, 索引: 整數, 長度: 整數)
void Sort(T[] array, int index, int length)
Sorts a run of elements in place in ascending order, leaving the rest of the array as it was.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to sort; null throws System.ArgumentNullException. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, a run past the end throws System.ArgumentException, and elements that are not comparable throw System.InvalidOperationException.
過載 11/17
排序(陣列: 陣列)
void Sort(Array array)
Sorts a one-dimensional array of any element type in place, in ascending order.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The one-dimensional array to sort; null throws System.ArgumentNullException, and a multidimensional array throws System.RankException. |
備註
The sort is not stable. Elements that are not comparable throw System.InvalidOperationException.
過載 12/17
排序(鍵: TKey 陣列, 項: TValue 陣列)
void Sort(TKey[] keys, TValue[] items)
Sorts an array of keys in ascending order and rearranges a second array the same way, so each item stays paired with its key; use it to sort names by their scores, for example.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | TKey 陣列 | — | The keys to sort by; null throws System.ArgumentNullException. |
| 項 | TValue 陣列 | — | The array rearranged alongside the keys; null sorts only the keys, and an array shorter than the keys throws System.ArgumentException. |
備註
The sort is not stable. Keys that are not comparable throw System.InvalidOperationException.
過載 13/17
排序(陣列: T 陣列, 比較器: IComparer<T>)
void Sort(T[] array, IComparer<T> comparer)
Sorts the whole array in place using the given comparer.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to sort; null throws System.ArgumentNullException. |
| 比較器 | IComparer<T> | — | The ordering to sort by; null uses the elements' default ordering, which throws System.InvalidOperationException if the elements are not comparable. |
備註
The sort is not stable: elements that compare equal may change order.
過載 14/17
排序(鍵: TKey 陣列, 項: TValue 陣列, 索引: 整數, 長度: 整數)
void Sort(TKey[] keys, TValue[] items, int index, int length)
Sorts a run of keys in ascending order and rearranges the matching run of a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | TKey 陣列 | — | The keys to sort by; null throws System.ArgumentNullException. |
| 項 | TValue 陣列 | — | The array rearranged alongside the keys; null sorts only the keys. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end of either array throws System.ArgumentException.
過載 15/17
排序
鍵: TKey 陣列
項: TValue 陣列
索引: 整數
長度: 整數
比較器: IComparer<TKey>void Sort(
TKey[] keys,
TValue[] items,
int index,
int length,
IComparer<TKey> comparer)Sorts a run of keys using the given comparer and rearranges the matching run of a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | TKey 陣列 | — | The keys to sort by; null throws System.ArgumentNullException. |
| 項 | TValue 陣列 | — | The array rearranged alongside the keys; null sorts only the keys. |
| 索引 | 整數 | — | The index of the first element of the run. |
| 長度 | 整數 | — | How many elements the run covers. |
| 比較器 | IComparer<TKey> | — | The ordering of the keys; null uses the keys' default ordering. |
備註
The sort is not stable. A negative index or length throws System.ArgumentOutOfRangeException, and a run past the end of either array throws System.ArgumentException.
過載 16/17
排序(陣列: T 陣列)
void Sort(T[] array)
Sorts the whole array in place in ascending order: numbers smallest first, text alphabetically.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to sort; null throws System.ArgumentNullException. |
備註
The sort is not stable. Elements that are not comparable throw System.InvalidOperationException.
過載 17/17
排序(鍵: TKey 陣列, 項: TValue 陣列, 比較器: IComparer<TKey>)
void Sort(TKey[] keys, TValue[] items, IComparer<TKey> comparer)
Sorts an array of keys using the given comparer and rearranges a second array the same way, so each item stays paired with its key.
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 鍵 | TKey 陣列 | — | The keys to sort by; null throws System.ArgumentNullException. |
| 項 | TValue 陣列 | — | The array rearranged alongside the keys; null sorts only the keys, and an array shorter than the keys throws System.ArgumentException. |
| 比較器 | IComparer<TKey> | — | The ordering of the keys; null uses the keys' default ordering. |
備註
The sort is not stable.
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
同步根
函數The object to lock on when several threads share this array; for an ordinary array it is the array itself.
同步根(陣列: 陣列) -> 任意
object SyncRoot(Array array)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | 陣列 | — | The array whose lock object is wanted. |
返回
| 結果 | 任意 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫
全部滿足條件
函數Whether every element passes a test, for questions such as "are all values positive?".
全部滿足條件(陣列: T 陣列, 匹配條件: Predicate<T>) -> 真否
bool TrueForAll(T[] array, Predicate<T> match)
參數
| 名稱 | 型別 | 預設值 | 說明 |
|---|---|---|---|
| 陣列 | T 陣列 | — | The array to check; null throws System.ArgumentNullException. |
| 匹配條件 | Predicate<T> | — | The test applied to each element; null throws System.ArgumentNullException. |
返回
| 結果 | 真否 |
- 所屬發行版
- 元編程(教育版)元編程(專業版)
- 可用的圖種類
- 資料流 函數 事件 例程 藍圖 狀態機狀態
- 宣告於
- 陣列操作
- 所屬包
- 標準庫