ProfileSettingsCollection.IndexOf Method (String)

 

Returns the index of the specified ProfileSettings object.

Namespace:   System.Web.Configuration
Assembly:  System.Web (in System.Web.dll)

public int IndexOf(
	string name
)

Parameters

name
Type: System.String

The name of a ProfileSettings object in the collection.

Return Value

Type: System.Int32

The index of the specified ProfileSettings object, or -1 if the object is not found in the collection.

The following code example shows how to use the IndexOf method. This code example is part of a larger example provided for the HealthMonitoringSection class.

// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
    healthMonitoringSection.Profiles.IndexOf("Default"));

.NET Framework
Available since 2.0
Return to top
Show: