元编程参考文档

数组操作

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.

返回

结果真否
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
数组操作
所属包
标准库