Share via


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 含めてはいけません。

適用対象

こちらもご覧ください