ProfileSettingsCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ProfileSettings オブジェクトのコレクションを含んでいます。 このクラスは継承できません。
public ref class ProfileSettingsCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfileSettings))]
public sealed class ProfileSettingsCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfileSettings))>]
type ProfileSettingsCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class ProfileSettingsCollection
Inherits ConfigurationElementCollection
- 継承
- 属性
例
次のコード例は、型の使用方法を ProfileSettingsCollection 示しています。 このコード例は、HealthMonitoringSection クラスのために提供されている大規模な例の一部です。
// Add a ProfileSettings object to the Profiles collection property.
ProfileSettings profileSetting = new ProfileSettings("Default");
profileSetting.Name = "Custom";
profileSetting.MaxLimit = Int32.MaxValue;
profileSetting.MinInstances = 1;
profileSetting.MinInterval = TimeSpan.Parse("00:01:00");
profileSetting.Custom = "MyEvaluators.MyCustomeEvaluator, MyCustom.dll";
healthMonitoringSection.Profiles.Add(profileSetting);
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Default"));
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Critical",
1, 1024, new TimeSpan(0, 0, 00)));
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Targeted",
1, Int32.MaxValue, new TimeSpan(0, 0, 10),
"MyEvaluators.MyTargetedEvaluator, MyCustom.dll"));
// Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"));
// Display contents of the Profiles collection property
Console.WriteLine(
"Profiles Collection contains {0} values:",
healthMonitoringSection.Profiles.Count);
// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.Profiles.Count; i++)
{
profileSetting = healthMonitoringSection.Profiles[i];
string name = profileSetting.Name;
int minInstances = profileSetting.MinInstances;
int maxLimit = profileSetting.MaxLimit;
TimeSpan minInterval = profileSetting.MinInterval;
string custom = profileSetting.Custom;
string item = "Name='" + name +
"', MinInstances = '" + minInstances + "', MaxLimit = '" + maxLimit +
"', MinInterval = '" + minInterval + "', Custom = '" + custom + "'";
Console.WriteLine(" Item {0}: {1}", i, item);
}
// See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.",
healthMonitoringSection.Profiles.Contains("Default"));
// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
healthMonitoringSection.Profiles.IndexOf("Default"));
// Get a named ProfileSettings
profileSetting = healthMonitoringSection.Profiles["Default"];
// Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Remove("Default");
// Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.RemoveAt(0);
// Clear all ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Clear();
' Add a ProfileSettings object to the Profiles collection property.
Dim profileSetting As ProfileSettings = New ProfileSettings("Default")
profileSetting.Name = "Custom"
profileSetting.MaxLimit = Int32.MaxValue
profileSetting.MinInstances = 1
profileSetting.MinInterval = TimeSpan.Parse("00:01:00")
profileSetting.Custom = "MyEvaluators.MyCustomeEvaluator, MyCustom.dll"
healthMonitoringSection.Profiles.Add(profileSetting)
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Default"))
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Critical", _
1, 1024, new TimeSpan(0, 0, 00)))
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Targeted", _
1, Int32.MaxValue, new TimeSpan(0, 0, 10), _
"MyEvaluators.MyTargetedEvaluator, MyCustom.dll"))
' Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"))
' Display contents of the Profiles collection property
Console.WriteLine( _
"Profiles Collection contains {0} values:", _
healthMonitoringSection.Profiles.Count)
' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.Profiles.Count - 1
profileSetting = healthMonitoringSection.Profiles(i)
Dim name As String = profileSetting.Name
Dim minInstances As Integer = profileSetting.MinInstances
Dim maxLimit As Integer = profileSetting.MaxLimit
Dim minInterval As TimeSpan = profileSetting.MinInterval
Dim custom As String = profileSetting.Custom
Dim item As String = "Name='" & name & _
"', MinInstances = '" & minInstances & "', MaxLimit = '" & maxLimit & _
"', MinInterval = '" & minInterval.ToString() & "', Custom = '" & custom & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.", _
healthMonitoringSection.Profiles.Contains("Default"))
' Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.", _
healthMonitoringSection.Profiles.IndexOf("Default"))
' Get a named ProfileSettings
profileSetting = healthMonitoringSection.Profiles("Default")
' Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Remove("Default")
' Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.RemoveAt(0)
' Clear all ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Clear()
注釈
ProfileSettings オブジェクトは、イベント プロファイルを定義するために使用されます。
コンストラクター
ProfileSettingsCollection() |
ProfileSettingsCollection クラスの新しいインスタンスを初期化します。 |
プロパティ
メソッド
明示的なインターフェイスの実装
ICollection.CopyTo(Array, Int32) |
ConfigurationElementCollection を配列にコピーします。 (継承元 ConfigurationElementCollection) |
拡張メソッド
Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。 |