Redigera

Dela via


RuleSettingsCollection.IndexOf(String) Method

Definition

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

public:
 int IndexOf(System::String ^ name);
public int IndexOf (string name);
member this.IndexOf : string -> int
Public Function IndexOf (name As String) As Integer

Parameters

name
String

The name of a RuleSettings object in the collection.

Returns

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

Examples

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

Remarks

Returns -1 if a RuleSettings object with the specified name is not in the collection.

Applies to

See also