M_Cyjb_ArrayUtil_Fill__1_7 - CYJB/Cyjb GitHub Wiki
将数组从指定的索引位置开始使用指定的值填充指定的长度。
Namespace: Cyjb
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public static T[] Fill<T>(
this T[] array,
T value,
int startIndex,
int count
)
- array
- Type: T[]
要填充的数组。 - value
- Type: T
要填充数组的值。 - startIndex
- Type: System.Int32
要开始填充的起始索引。 - count
- Type: System.Int32
要填充的数组元素个数。
- T
- 数组中元素的类型。
Type: T[]
填充完毕的数组。
在 Visual Basic 和 C# 中,这个方法可以当成为类型的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic) 或 扩展方法 (C# 编程指南) 获取更多信息。
异常 | 条件 |
---|---|
ArgumentNullException |
array 为null 。 |
ArgumentOutOfRangeException | startIndex 或 count 小于零。 |
ArgumentOutOfRangeException | startIndex 加 count 之和大于数组的长度。 |