Array.Initialize Array.Initialize Array.Initialize Array.Initialize Method

定義

呼叫實值型別的無參數建構函式,初始化實值型別 Array 的每個項目。Initializes every element of the value-type Array by calling the parameterless constructor of the value type.

public:
 void Initialize();
public void Initialize ();
member this.Initialize : unit -> unit
Public Sub Initialize ()

備註

這個方法是設計來協助編譯器支援實數值型別陣列;大部分的使用者都不需要這個方法。This method is designed to help compilers support value-type arrays; most users do not need this method. 它不得用在參考型別陣列上。It must not be used on reference-type arrays.

如果不是實值型別, Array或如果實值型別沒有無參數的函式, Array則不會修改。 ArrayIf the Array is not a value-type Array or if the value type does not have a parameterless constructor, the Array is not modified.

實數值型別Array可以有任何下限和任意數目的維度。The value-type Array can have any lower bound and any number of dimensions.

這個方法是 O (n)運算,其中nLengthThis method is an O(n) operation, where n is Length.

警告

您只能在具有函數的實值型別上使用這個方法;不過,原生C#的實值型別沒有任何函式。You can use this method only on value types that have constructors; however, value types that are native to C# do not have constructors.

適用於