元編程參考文件

陣列操作

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/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.

返回

ResultT
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
陣列操作
所屬包
標準庫

查詢全部

函數

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.

返回

ResultT
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
陣列操作
所屬包
標準庫

查詢最後索引

函數

過載 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

簽名
排序
    鍵: 陣列
    項: 陣列
    索引: 整數
    長度: 整數
    比較器: IComparer
void 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.

返回

結果真否
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
陣列操作
所屬包
標準庫