ProfileSettingsCollection Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains a collection of ProfileSettings objects. This class cannot be inherited.
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
- Inheritance
- Attributes
The following code example shows how to use the ProfileSettingsCollection type. This code example is part of a larger example provided for the HealthMonitoringSection class.
// 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 objects are used to define event profiles.
Profile |
Initializes a new instance of the ProfileSettingsCollection class. |
Add |
Gets or sets the name of the ConfigurationElement to associate with the add operation in the ConfigurationElementCollection when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Clear |
Gets or sets the name for the ConfigurationElement to associate with the clear operation in the ConfigurationElementCollection when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Collection |
Gets the type of the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Count |
Gets the number of elements in the collection. (Inherited from ConfigurationElementCollection) |
Current |
Gets a reference to the top-level Configuration instance that represents the configuration hierarchy that the current ConfigurationElement instance belongs to. (Inherited from ConfigurationElement) |
Element |
Gets an ElementInformation object that contains the non-customizable information and functionality of the ConfigurationElement object. (Inherited from ConfigurationElement) |
Element |
Gets the name used to identify this collection of elements in the configuration file when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Element |
Gets the ConfigurationElementProperty object that represents the ConfigurationElement object itself. (Inherited from ConfigurationElement) |
Emit |
Gets or sets a value that specifies whether the collection has been cleared. (Inherited from ConfigurationElementCollection) |
Evaluation |
Gets the ContextInformation object for the ConfigurationElement object. (Inherited from ConfigurationElement) |
Has |
Gets a value that indicates whether the CurrentConfiguration property is |
Is |
Gets a value indicating whether access to the collection is synchronized. (Inherited from ConfigurationElementCollection) |
Item[Configuration |
Gets or sets a property or attribute of this configuration element. (Inherited from ConfigurationElement) |
Item[Int32] |
Gets or sets the ProfileSettings object at the specified numeric index in the collection. |
Item[String] |
Gets the ProfileSettings object based on the specified key in the collection. |
Lock |
Gets the collection of locked attributes. (Inherited from ConfigurationElement) |
Lock |
Gets the collection of locked elements. (Inherited from ConfigurationElement) |
Lock |
Gets the collection of locked attributes. (Inherited from ConfigurationElement) |
Lock |
Gets the collection of locked elements. (Inherited from ConfigurationElement) |
Lock |
Gets or sets a value indicating whether the element is locked. (Inherited from ConfigurationElement) |
Properties |
Gets the collection of properties. (Inherited from ConfigurationElement) |
Remove |
Gets or sets the name of the ConfigurationElement to associate with the remove operation in the ConfigurationElementCollection when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Sync |
Gets an object used to synchronize access to the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Throw |
Gets a value indicating whether an attempt to add a duplicate ConfigurationElement to the ConfigurationElementCollection will cause an exception to be thrown. (Inherited from ConfigurationElementCollection) |
Add(Profile |
Adds a ProfileSettings object to the collection. |
Base |
Adds a configuration element to the configuration element collection. (Inherited from ConfigurationElementCollection) |
Base |
Adds a configuration element to the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Base |
Adds a configuration element to the configuration element collection. (Inherited from ConfigurationElementCollection) |
Base |
Removes all configuration element objects from the collection. (Inherited from ConfigurationElementCollection) |
Base |
Gets the configuration element at the specified index location. (Inherited from ConfigurationElementCollection) |
Base |
Returns the configuration element with the specified key. (Inherited from ConfigurationElementCollection) |
Base |
Returns an array of the keys for all of the configuration elements contained in the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Base |
Gets the key for the ConfigurationElement at the specified index location. (Inherited from ConfigurationElementCollection) |
Base |
Indicates the index of the specified ConfigurationElement. (Inherited from ConfigurationElementCollection) |
Base |
Indicates whether the ConfigurationElement with the specified key has been removed from the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Base |
Removes a ConfigurationElement from the collection. (Inherited from ConfigurationElementCollection) |
Base |
Removes the ConfigurationElement at the specified index location. (Inherited from ConfigurationElementCollection) |
Clear() |
Removes all ProfileSettings objects from the collection. |
Contains(String) |
Indicates whether the collection contains a ProfileSettings object with the specified name. |
Copy |
Copies the contents of the ConfigurationElementCollection to an array. (Inherited from ConfigurationElementCollection) |
Create |
When overridden in a derived class, creates a new ConfigurationElement. (Inherited from ConfigurationElementCollection) |
Create |
Creates a new ConfigurationElement when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Deserialize |
Reads XML from the configuration file. (Inherited from ConfigurationElement) |
Equals(Object) |
Compares the ConfigurationElementCollection to the specified object. (Inherited from ConfigurationElementCollection) |
Get |
Gets the element key for a specified configuration element when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Get |
Gets an IEnumerator which is used to iterate through the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Get |
Gets a unique value representing the ConfigurationElementCollection instance. (Inherited from ConfigurationElementCollection) |
Get |
Returns the transformed version of the specified assembly name. (Inherited from ConfigurationElement) |
Get |
Returns the transformed version of the specified type name. (Inherited from ConfigurationElement) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Index |
Returns the index of the specified ProfileSettings object. |
Init() |
Sets the ConfigurationElement object to its initial state. (Inherited from ConfigurationElement) |
Initialize |
Used to initialize a default set of values for the ConfigurationElement object. (Inherited from ConfigurationElement) |
Insert(Int32, Profile |
Inserts the specified ProfileSettings object at the specified index in the collection. |
Is |
Indicates whether the specified ConfigurationElement exists in the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Is |
Indicates whether the specified ConfigurationElement can be removed from the ConfigurationElementCollection. (Inherited from ConfigurationElementCollection) |
Is |
Indicates whether this ConfigurationElementCollection has been modified since it was last saved or loaded when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Is |
Indicates whether the ConfigurationElementCollection object is read only. (Inherited from ConfigurationElementCollection) |
List |
Adds the invalid-property errors in this ConfigurationElement object, and in all subelements, to the passed list. (Inherited from ConfigurationElement) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
On |
Gets a value indicating whether an unknown attribute is encountered during deserialization. (Inherited from ConfigurationElement) |
On |
Causes the configuration system to throw an exception. (Inherited from ConfigurationElementCollection) |
On |
Throws an exception when a required property is not found. (Inherited from ConfigurationElement) |
Post |
Called after deserialization. (Inherited from ConfigurationElement) |
Pre |
Called before serialization. (Inherited from ConfigurationElement) |
Remove(String) |
Removes a BufferModeSettings object from the collection. |
Remove |
Removes a ProfileSettings object at the specified index location from the collection. |
Reset(Configuration |
Resets the ConfigurationElementCollection to its unmodified state when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Reset |
Resets the value of the IsModified() property to |
Serialize |
Writes the configuration data to an XML element in the configuration file when overridden in a derived class. (Inherited from ConfigurationElementCollection) |
Serialize |
Writes the outer tags of this configuration element to the configuration file when implemented in a derived class. (Inherited from ConfigurationElement) |
Set |
Sets a property to the specified value. (Inherited from ConfigurationElement) |
Set |
Sets the IsReadOnly() property for the ConfigurationElementCollection object and for all sub-elements. (Inherited from ConfigurationElementCollection) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Unmerge(Configuration |
Reverses the effect of merging configuration information from different levels of the configuration hierarchy. (Inherited from ConfigurationElementCollection) |
ICollection. |
Copies the ConfigurationElementCollection to an array. (Inherited from ConfigurationElementCollection) |
Cast<TResult>(IEnumerable) |
Casts the elements of an IEnumerable to the specified type. |
Of |
Filters the elements of an IEnumerable based on a specified type. |
As |
Enables parallelization of a query. |
As |
Converts an IEnumerable to an IQueryable. |
Produkt | Versionen |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Feedback zu .NET
.NET ist ein Open Source-Projekt. Wählen Sie einen Link aus, um Feedback zu geben: