Array.Fill Array.Fill Array.Fill Array.Fill Method

定義

多載

Fill<T>(T[], T) Fill<T>(T[], T) Fill<T>(T[], T) Fill<T>(T[], T)

將型別為 T 的給定 value,指派至所指定 array 的每個元素。Assigns the given value of type T to each element of the specified array.

Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32)

將型別為 T 的給定 value,指派至所指定 array 的元素,範圍從 startIndex (包含) 到下一個 count 數目的索引。Assigns the given value of type T to the elements of the specified array which are within the range of startIndex (inclusive) and the next count number of indices.

Fill<T>(T[], T) Fill<T>(T[], T) Fill<T>(T[], T) Fill<T>(T[], T)

將型別為 T 的給定 value,指派至所指定 array 的每個元素。Assigns the given value of type T to each element of the specified array.

public:
generic <typename T>
 static void Fill(cli::array <T> ^ array, T value);
public static void Fill<T> (T[] array, T value);
static member Fill : 'T[] * 'T -> unit
Public Shared Sub Fill(Of T) (array As T(), value As T)

類型參數

T

陣列中項目的型別。The type of the elements in the array.

參數

array
T[]

要填入的陣列。The array to be filled.

value
T T T T

要指派給每個陣列元素的值。The value to assign to each array element.

Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32) Fill<T>(T[], T, Int32, Int32)

將型別為 T 的給定 value,指派至所指定 array 的元素,範圍從 startIndex (包含) 到下一個 count 數目的索引。Assigns the given value of type T to the elements of the specified array which are within the range of startIndex (inclusive) and the next count number of indices.

public:
generic <typename T>
 static void Fill(cli::array <T> ^ array, T value, int startIndex, int count);
public static void Fill<T> (T[] array, T value, int startIndex, int count);
static member Fill : 'T[] * 'T * int * int -> unit
Public Shared Sub Fill(Of T) (array As T(), value As T, startIndex As Integer, count As Integer)

類型參數

T

陣列項目的類型。The type of the elements of the array.

參數

array
T[]

要填入的 ArrayThe Array to be filled.

value
T T T T

所指定範圍中元素的新值。The new value for the elements in the specified range.

startIndex
Int32 Int32 Int32 Int32

32 位元整數,代表 Array 中的索引,由此開始填入。A 32-bit integer that represents the index in the Array at which filling begins.

count
Int32 Int32 Int32 Int32

要複製的項目數目。The number of elements to copy.

適用於