Share via


AdministrationModuleCollection.Item[] Property

Definition

Gets the specified administration module from the collection.

Overloads

Item[Int32]

Gets the administration module at the specified index location in the collection.

Item[String]

Gets the AdministrationModule object that has the specified name from the collection.

Item[Int32]

Gets the administration module at the specified index location in the collection.

public:
 property Microsoft::Web::Management::Server::AdministrationModule ^ default[int] { Microsoft::Web::Management::Server::AdministrationModule ^ get(int index); };
public Microsoft.Web.Management.Server.AdministrationModule this[int index] { get; }
member this.Item(int) : Microsoft.Web.Management.Server.AdministrationModule
Default Public ReadOnly Property Item(index As Integer) As AdministrationModule

Parameters

index
Int32

The zero-based index of the AdministrationModule to get from the collection.

Property Value

The AdministrationModule at the specified index number.

Exceptions

The index value is less than 0 or is greater than or equal to the number of elements in the collection.

Examples

The following example demonstrates the Item[] property. This code example is part of a larger example provided for the AdministrationModuleCollection class.

base.OnActivated(initialActivation);
if (initialActivation)
{
    InitializeComponent();
    _serviceProxy = (DemoModuleServiceProxy)
        Connection.CreateProxy(Module, typeof(DemoModuleServiceProxy));

    AdministrationModuleCollection adminmodules =
        _serviceProxy.GetAdminModuleCollection();
    ArrayList moduleProviders = _serviceProxy.GetAdminProviderList();

    string collectiondisplay = null;
    collectiondisplay = adminmodules.ToString() + ":\nThere are "
        + adminmodules.Count + " modules in Administration.config\n\n";
    // Use the index to get the second AdministrationModule in the collection.
    collectiondisplay = collectiondisplay + "Second module: "
        + adminmodules[1].Name + "\n\n";
    // Display the name of each AdministrationModule.
    foreach (AdministrationModule adminModule in adminmodules)
    {
        collectiondisplay = collectiondisplay.ToString()
            + adminModule.Name + "\n";
    }

    string providersdisplay = null;
    providersdisplay = "There are " + moduleProviders.Count
        + " modules in Administration.config\n\n";
    // Display the name and type of each AdministrationModuleProvider.
    foreach (AdministrationModuleProvider
        adminProviderModule in moduleProviders)
    {
        providersdisplay = providersdisplay + adminProviderModule.Name +
            " - " + adminProviderModule.Type + "\n";
    }
    // Display either AdministrationModuleCollection or 
    // the AdministrationModuleProvider list.
    testLabel.Text = collectiondisplay;
    //testLabel.Text = providersdisplay;
}

Remarks

You can use the overloads of the Item[] property to return a specific AdministrationModule object in the collection. This overload returns a specific module in the collection by the collection index.

Applies to

Item[String]

Gets the AdministrationModule object that has the specified name from the collection.

public:
 property Microsoft::Web::Management::Server::AdministrationModule ^ default[System::String ^] { Microsoft::Web::Management::Server::AdministrationModule ^ get(System::String ^ name); };
public Microsoft.Web.Management.Server.AdministrationModule this[string name] { get; }
member this.Item(string) : Microsoft.Web.Management.Server.AdministrationModule
Default Public ReadOnly Property Item(name As String) As AdministrationModule

Parameters

name
String

The name of the AdministrationModule object to get from the collection.

Property Value

The AdministrationModule object that has the specified name.

Exceptions

The name of the AdministrationModule object does not exist in the collection.

Remarks

You can use the overloads of the Item[] property to return a specific AdministrationModule object in the collection. This overload returns a specific module in the collection by name. The specific module performs a case-insensitive string comparison by using ordinal sort rules.

Applies to