RuleSettingsCollection.IndexOf Method (String)

 

Finds the index of a RuleSettings object in the collection with the specified name.

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

Public Function IndexOf (
	name As String
) As Integer

Parameters

name
Type: System.String

The name of a RuleSettings object in the collection.

Return Value

Type: System.Int32

The index of a RuleSettings object in the collection with the specified name.

Returns -1 if a RuleSettings object with the specified name is not 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 'All Errors Default' RuleSettings in the Rules collection property.
Console.WriteLine("EventMappings index for 'All Errors Default': {0}.", _
    healthMonitoringSection.Rules.IndexOf("All Errors Default"))

.NET Framework
Available since 2.0
Return to top
Show: