Collection 建構函式

定義

建立並傳回新的Visual Basic Collection 物件。Creates and returns a new Visual Basic Collection object.

public:
 Collection();
public Collection ();
Public Sub New ()

範例

下列範例會建立新的 Visual Basic 集合,並將它指派給變數 collThe following example creates a new Visual Basic collection and assigns it to the variable coll:

Dim coll As New Microsoft.VisualBasic.Collection()  

這個 Collection 物件是以一為基礎,這表示元素的索引值範圍是從1到 Count 屬性的值。This Collection object is one-based, which means that the index values of the elements range from 1 through the value of the Count property. Visual Basic 集合會保留 Object類型的元素。Visual Basic collections hold elements of type Object.

備註

此函式所傳回的 Visual Basic 集合是空的,而且沒有任何初始容量配置。The Visual Basic collection returned by this constructor is empty and does not have any initial capacity allocated.

Visual Basic 集合與 System.CollectionsSystem.Collections.GenericSystem.Collections.Specialized 命名空間中可用的 .NET Framework.NET Framework 集合不相容。Visual Basic collections are not compatible with the .NET Framework.NET Framework collections available in the System.Collections, System.Collections.Generic, and System.Collections.Specialized namespaces.

適用於