共用方式為


InstanceEnumeration Constructor

Creates an object of the InstanceEnumeration class.

命名空間: Microsoft.SqlServer.NotificationServices
組件: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

語法

'宣告
Public Sub New
public InstanceEnumeration ()
public:
InstanceEnumeration ()
public InstanceEnumeration ()
public function InstanceEnumeration ()

備註

The InstanceEnumeration constructor can be used in both managed and unmanaged code because it does not require any parameters.

範例

The following examples show how to create and initialize an InstanceEnumeration object in managed code:

'Create an InstanceEnumeration object.
Dim myInstanceEnumeration As New InstanceEnumeration()

'Iterate through the instance descriptions.
Dim instanceDescription As NSInstanceDescription
For Each instanceDescription In myInstanceEnumeration
    Console.WriteLine("Instance Name: {0}", _
    instanceDescription.InstanceName)
Next instanceDescription
//InstanceEnumeration.GetEnumerator Method sample

//Create an InstanceEnumeration object.
InstanceEnumeration myInstanceEnumeration = 
    new InstanceEnumeration();

//Iterate through the instance descriptions.
foreach (NSInstanceDescription instanceDescription 
    in myInstanceEnumeration)
{
    Console.WriteLine("Instance Name: {0}", 
        instanceDescription.InstanceName);
}

The following example shows how to create an InstanceEnumeration object in unmanaged Microsoft Visual Basic Scripting Edition (VBScript) code:

'Create an InstanceEnumeration object.
set myInstanceEnumeration = WScript.CreateObject("Microsoft.SqlServer.NotificationServices.InstanceEnumeration")

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

InstanceEnumeration Class
InstanceEnumeration Members
Microsoft.SqlServer.NotificationServices Namespace