この記事は機械翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。 詳細情報
訳文
原文
このトピックはまだ評価されていません - このトピックを評価する

RuleSettingsCollection クラス

RuleSettings オブジェクトのコレクション。 このクラスは継承できません。

名前空間:  System.Web.Configuration
アセンブリ:  System.Web (System.Web.dll 内)
[ConfigurationCollectionAttribute(typeof(RuleSettings))]
public sealed class RuleSettingsCollection : ConfigurationElementCollection

RuleSettingsCollection 型で公開されるメンバーは以下のとおりです。

  名前説明
パブリック メソッドRuleSettingsCollectionインフラストラクチャ。 RuleSettingsCollection クラスの新しいインスタンスを初期化します。
このページのトップへ
  名前説明
プロテクト プロパティAddElementName派生クラスでオーバーライドされると、ConfigurationElementCollection での追加操作に関連付ける ConfigurationElement の名前を取得または設定します。 (ConfigurationElementCollection から継承されます。)
プロテクト プロパティClearElementName派生クラスでオーバーライドされると、ConfigurationElementCollection での消去操作に関連付ける ConfigurationElement の名前を取得または設定します。 (ConfigurationElementCollection から継承されます。)
パブリック プロパティCollectionType ConfigurationElementCollection の型を取得します。 (ConfigurationElementCollection から継承されます。)
パブリック プロパティCountコレクション内の要素の数を取得します。 (ConfigurationElementCollection から継承されます。)
パブリック プロパティCurrentConfiguration現在の ConfigurationElement インスタンスが属している構成階層を表す最上位の Configuration インスタンスへの参照を取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティElementInformation ConfigurationElement オブジェクトのカスタマイズできない情報と機能を格納する ElementInformation オブジェクトを取得します。 (ConfigurationElement から継承されます。)
プロテクト プロパティElementProperty ConfigurationElement オブジェクト自体を表す ConfigurationElementProperty オブジェクトを取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティEmitClearコレクションが削除されたかどうかを示す値を取得または設定します。 (ConfigurationElementCollection から継承されます。)
パブリック プロパティIsSynchronizedコレクションへのアクセスの同期がとられているかどうかを示す値を取得します。 (ConfigurationElementCollection から継承されます。)
プロテクト プロパティItem[ConfigurationProperty]この構成要素のプロパティまたは属性を取得または設定します。 (ConfigurationElement から継承されます。)
パブリック プロパティItem[Int32]指定した数値インデックス位置にある RuleSettings オブジェクトを取得します。
パブリック プロパティItem[String]コレクション内の指定されたキーに基づいて、RuleSettings オブジェクトを取得します。
パブリック プロパティLockAllAttributesExceptロックされている属性のコレクションを取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティLockAllElementsExceptロックされている要素のコレクションを取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティLockAttributesロックされている属性のコレクションを取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティLockElementsロックされている要素のコレクションを取得します。 (ConfigurationElement から継承されます。)
パブリック プロパティLockItem要素がロックされているかどうかを示す値を取得または設定します。 (ConfigurationElement から継承されます。)
プロテクト プロパティPropertiesプロパティのコレクションを取得します。 (ConfigurationElement から継承されます。)
プロテクト プロパティRemoveElementName派生クラスでオーバーライドされると、ConfigurationElementCollection での削除操作に関連付ける ConfigurationElement の名前を取得または設定します。 (ConfigurationElementCollection から継承されます。)
パブリック プロパティSyncRoot ConfigurationElementCollection へのアクセスを同期するために使用するオブジェクトを取得します。 (ConfigurationElementCollection から継承されます。)
このページのトップへ
  名前説明
パブリック メソッドAdd RuleSettings オブジェクトをコレクションに追加します。
プロテクト メソッドBaseAdd(ConfigurationElement, Boolean)構成要素のコレクションに構成要素を追加します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseClearコレクションからすべての構成要素オブジェクトを削除します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseGet(Int32)指定したインデックス位置にある構成要素を取得します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseGet(Object)指定したキーを持つ構成要素を返します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseGetAllKeys ConfigurationElementCollection に格納されているすべての構成要素のキーの配列を返します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseGetKey指定したインデックス位置にある ConfigurationElement のキーを取得します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseIsRemoved指定したキーを持つ ConfigurationElementConfigurationElementCollection から削除されているかどうかを示します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseRemove ConfigurationElement をコレクションから削除します。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドBaseRemoveAt指定したインデックス位置にある ConfigurationElement を削除します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドClearすべての RuleSettings オブジェクトをコレクションから削除します。
パブリック メソッドContains指定した名前の RuleSettings オブジェクトがコレクションに格納されている場合は true を返します。
パブリック メソッドCopyTo ConfigurationElementCollection の内容を配列にコピーします。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドDeserializeElement構成ファイルから XML を読み取ります。 (ConfigurationElement から継承されます。)
パブリック メソッドEquals ConfigurationElementCollection と指定したオブジェクトを比較します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドGetEnumeratorインフラストラクチャ。 ConfigurationElementCollection の反復処理に使用する IEnumerator を取得します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドGetHashCode ConfigurationElementCollection インスタンスを表す一意の値を取得します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドGetType現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッドIndexOfコレクション内の、指定した名前の RuleSettings オブジェクトのインデックスを検索します。
プロテクト メソッドInit ConfigurationElement オブジェクトを初期状態に設定します。 (ConfigurationElement から継承されます。)
プロテクト メソッドInitializeDefault ConfigurationElement オブジェクトの既定の値セットを初期化するために使用します。 (ConfigurationElement から継承されます。)
パブリック メソッドInsert指定した RuleSettings オブジェクトを、コレクションの指定したインデックス位置に追加します。
プロテクト メソッドIsModified派生クラスでオーバーライドされると、この ConfigurationElementCollection が最後に保存された後または読み込まれた後に、変更されているかどうかを示します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドIsReadOnly ConfigurationElementCollection オブジェクトが読み取り専用かどうかを示します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドRemoveコレクションから RuleSettings オブジェクトを削除します。
パブリック メソッドRemoveAt指定したインデックス位置にある RuleSettings オブジェクトをコレクションから削除します。
プロテクト メソッドReset派生クラスでオーバーライドされると、ConfigurationElementCollection を変更されていない状態にリセットします。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドResetModified派生クラスでオーバーライドされると、IsModified プロパティの値を false にリセットします。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドSerializeElement派生クラスでオーバーライドされると、構成データを構成ファイルの XML 要素に書き込みます。 (ConfigurationElementCollection から継承されます。)
プロテクト メソッドSerializeToXmlElement派生クラスに実装されている場合、この構成要素の外側のタグを構成ファイルに書き込みます。 (ConfigurationElement から継承されます。)
プロテクト メソッドSetReadOnlyインフラストラクチャ。 ConfigurationElementCollection オブジェクトとすべてのサブ要素の IsReadOnly プロパティを設定します。 (ConfigurationElementCollection から継承されます。)
パブリック メソッドToString 現在のオブジェクトを表す文字列を返します。 (Object から継承されます。)
プロテクト メソッドUnmergeインフラストラクチャ。構成階層の異なるレベルの構成情報をマージした効果を反転させます。 (ConfigurationElementCollection から継承されます。)
このページのトップへ
  名前説明
明示的なインターフェイス実装プライベート メソッドICollection.CopyTo ConfigurationElementCollection を配列にコピーします。 (ConfigurationElementCollection から継承されます。)
このページのトップへ

RuleSettings オブジェクトは、イベント規則の定義に使用します。

RuleSettingsCollection 型を使用する方法を次のコード例に示します。 このコード例は、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.
healthMonitoringSection.Rules.Add(new RuleSettings("All Errors Default", 
    "All Errors", "EventLogProvider"));

// Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Default",
    "Failure Audits", "EventLogProvider", "Default", 1, Int32.MaxValue,
    new TimeSpan(0, 1, 0)));

// Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Custom",
    "Failure Audits", "EventLogProvider", "Custom", 1, Int32.MaxValue,
    new TimeSpan(0, 1, 0), "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll"));

// Insert an RuleSettings object into the Rules collection property.
healthMonitoringSection.Rules.Insert(1,
    new RuleSettings("All Errors Default2",
        "All Errors", "EventLogProvider"));

// Display contents of the Rules collection property
Console.WriteLine(
    "Rules Collection contains {0} values:", healthMonitoringSection.Rules.Count);

// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.Rules.Count; i++)
{
ruleSetting = healthMonitoringSection.Rules[i];
string name = ruleSetting.Name;
string eventName = ruleSetting.EventName;
string provider = ruleSetting.Provider;
string profile = ruleSetting.Profile;
int minInstances = ruleSetting.MinInstances;
int maxLimit = ruleSetting.MaxLimit;
TimeSpan minInterval = ruleSetting.MinInterval;
string custom = ruleSetting.Custom;
    string item = "Name='" + name + "', EventName='" + eventName +
        "', Provider =  '" + provider + "', Profile =  '" + profile +
        "', MinInstances =  '" + minInstances + "', MaxLimit =  '" + maxLimit +
        "', MinInterval =  '" + minInterval + "', Custom =  '" + custom + "'";
    Console.WriteLine("  Item {0}: {1}", i, item);
}

// See if the Rules collection property contains the RuleSettings 'All Errors Default'.
Console.WriteLine("EventMappings contains 'All Errors Default': {0}.",
    healthMonitoringSection.Rules.Contains("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"));

// Get a named RuleSettings
ruleSetting = healthMonitoringSection.Rules["All Errors Default"];

// Remove a RuleSettings object from the Rules collection property.
healthMonitoringSection.Rules.Remove("All Errors Default");

// Remove a RuleSettings object from the Rules collection property.
healthMonitoringSection.Rules.RemoveAt(0);

// Clear all RuleSettings object from the Rules collection property.
healthMonitoringSection.Rules.Clear();



.NET Framework

サポート対象 : 4.5、4、3.5、3.0、2.0

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (サーバー コア ロールはサポート対象外), Windows Server 2008 R2 (SP1 以降でサーバー コア ロールをサポート。Itanium はサポート対象外)

.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
この型のすべてのパブリック static (Visual Basic では Shared) メンバーは、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。
この情報は役に立ちましたか。
(残り 1500 文字)

コミュニティの追加

追加
© 2013 Microsoft. All rights reserved.