Partager via


Array.Initialize Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Initializes every element of the value-type Array by calling the default constructor of the value type.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Sub Initialize
[SecuritySafeCriticalAttribute]
public void Initialize()

Remarks

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.

If the Array is not a value-type Array or if the value type does not have a default constructor, the Array is not modified.

The value-type Array can have any lower bound and any number of dimensions.

This method is an O(n) operation, where n is Length.

Caution noteCaution:

You can use this method only on value types that have constructors; however, value types that are native to C# do not have constructors.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference