RuleSettingsCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
RuleSettings 개체의 컬렉션입니다. 이 클래스는 상속될 수 없습니다.
public ref class RuleSettingsCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.RuleSettings))]
public sealed class RuleSettingsCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.RuleSettings))>]
type RuleSettingsCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class RuleSettingsCollection
Inherits ConfigurationElementCollection
- 상속
- 특성
예제
다음 코드 예제를 사용 하는 방법을 보여 줍니다는 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();
' 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)
' 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 i As System.Int32 = 0 To healthMonitoringSection.Rules.Count -1
ruleSetting = healthMonitoringSection.Rules(i)
Dim name As String = ruleSetting.Name
Dim eventName As String = ruleSetting.EventName
Dim provider As String = ruleSetting.Provider
Dim profile As String = ruleSetting.Profile
Dim minInstances As Integer = ruleSetting.MinInstances
Dim maxLimit As Integer = ruleSetting.MaxLimit
Dim minInterval As TimeSpan = ruleSetting.MinInterval
Dim custom As String = ruleSetting.Custom
Dim item As String = "Name='" & name & "', EventName='" & eventName & _
"', Provider = '" & provider & "', Profile = '" & profile & _
"', MinInstances = '" & minInstances & "', MaxLimit = '" & maxLimit & _
"', MinInterval = '" & minInterval.ToString() & "', Custom = '" & custom & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' 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()
설명
RuleSettings 개체는 이벤트 규칙을 정의 하는 데 사용 됩니다.
생성자
RuleSettingsCollection() |
RuleSettingsCollection 클래스의 새 인스턴스를 초기화합니다. |
속성
메서드
명시적 인터페이스 구현
ICollection.CopyTo(Array, Int32) |
ConfigurationElementCollection을 배열에 복사합니다. (다음에서 상속됨 ConfigurationElementCollection) |
확장 메서드
Cast<TResult>(IEnumerable) |
IEnumerable의 요소를 지정된 형식으로 캐스팅합니다. |
OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable의 요소를 필터링합니다. |
AsParallel(IEnumerable) |
쿼리를 병렬화할 수 있도록 합니다. |
AsQueryable(IEnumerable) |
IEnumerable을 IQueryable로 변환합니다. |