Share via


InstanceEnumeration Constructor

Creates an object of the InstanceEnumeration class.

Namespace: Microsoft.SqlServer.NotificationServices
Assembly: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

Syntax

'Declaration
Public Sub New
public InstanceEnumeration ()
public:
InstanceEnumeration ()
public InstanceEnumeration ()
public function InstanceEnumeration ()

Remarks

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

Example

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")

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

InstanceEnumeration Class
InstanceEnumeration Members
Microsoft.SqlServer.NotificationServices Namespace