RuleSettingsCollection.Add(RuleSettings) 메서드

정의

컬렉션에 RuleSettings 개체를 추가합니다.

public:
 void Add(System::Web::Configuration::RuleSettings ^ ruleSettings);
public void Add(System.Web.Configuration.RuleSettings ruleSettings);
member this.Add : System.Web.Configuration.RuleSettings -> unit
Public Sub Add (ruleSettings As RuleSettings)

매개 변수

ruleSettings
RuleSettings

RuleSettings 컬렉션에 추가할 개체입니다.

예외

추가할 개체가 RuleSettings 컬렉션에 이미 있거나 컬렉션이 읽기 전용입니다.

예제

다음 코드 예제에서는 메서드를 사용 하는 방법을 보여 있습니다 Add . 이 코드 예제는 클래스에 제공된 더 큰 예제의 HealthMonitoringSection 일부입니다.

// Add a RuleSettings object to the Rules collection property.
RuleSettings ruleSetting = new RuleSettings("All Errors Default",
    "All Errors", "EventLogProvider");
ruleSetting.Name = "All Errors Custom";
ruleSetting.EventName = "All Errors";
ruleSetting.Provider = "EventLogProvider";
ruleSetting.Profile = "Custom";
ruleSetting.MaxLimit = Int32.MaxValue;
ruleSetting.MinInstances = 1;
ruleSetting.MinInterval = TimeSpan.Parse("00:00:30");
ruleSetting.Custom = "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll";
healthMonitoringSection.Rules.Add(ruleSetting);
' Add a RuleSettings object to the Rules collection property.
Dim ruleSetting As RuleSettings = new RuleSettings("All Errors Default", _
    "All Errors", "EventLogProvider")
ruleSetting.Name = "All Errors Custom"
ruleSetting.EventName = "All Errors"
ruleSetting.Provider = "EventLogProvider"
ruleSetting.Profile = "Custom"
ruleSetting.MaxLimit = Int32.MaxValue
ruleSetting.MinInstances = 1
ruleSetting.MinInterval = TimeSpan.Parse("00:00:30")
ruleSetting.Custom = "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll"
healthMonitoringSection.Rules.Add(ruleSetting)

설명

컬렉션에 이름이 같은 개체가 RuleSettings 아직 포함되어 있지 않아야 합니다.

적용 대상

추가 정보