EventMappingSettingsCollection 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.
Provides a collection of EventMappingSettings objects. This class cannot be inherited.
public ref class EventMappingSettingsCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.EventMappingSettings))]
public sealed class EventMappingSettingsCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.EventMappingSettings))>]
type EventMappingSettingsCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class EventMappingSettingsCollection
Inherits ConfigurationElementCollection
- Inheritance
- Attributes
The following code example shows how to use the EventMappingSettingsCollection type. This code example is part of a larger example provided for the HealthMonitoringSection class.
// Add a EventMappingsSettings object to the EventMappings collection property.
EventMappingSettings eventMappingSetting = new EventMappingSettings(
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web");
eventMappingSetting.Name = "All Errors";
eventMappingSetting.Type =
"System.Web.Management.WebErrorEvent, System.Web";
eventMappingSetting.StartEventCode = 0;
eventMappingSetting.EndEventCode = 4096;
healthMonitoringSection.EventMappings.Add(eventMappingSetting);
// Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings(
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web"));
// Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings(
"Success Audits", "System.Web.Management.WebAuditEvent, System.Web",
512, Int32.MaxValue));
// Insert an EventMappingsSettings object into the EventMappings collection property.
healthMonitoringSection.EventMappings.Insert(1,
new EventMappingSettings("HeartBeats", "", 1, 2));
// Display contents of the EventMappings collection property
Console.WriteLine(
"EventMappings Collection contains {0} values:", healthMonitoringSection.EventMappings.Count);
// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.EventMappings.Count; i++)
{
eventMappingSetting = healthMonitoringSection.EventMappings[i];
string name = eventMappingSetting.Name;
string type = eventMappingSetting.Type;
int startCd = eventMappingSetting.StartEventCode;
int endCd = eventMappingSetting.EndEventCode;
string item = "Name='" + name + "', Type='" + type +
"', StartEventCode = '" + startCd.ToString() +
"', EndEventCode = '" + endCd.ToString() + "'";
Console.WriteLine(" Item {0}: {1}", i, item);
}
// See if the EventMappings collection property contains the event 'HeartBeats'.
Console.WriteLine("EventMappings contains 'HeartBeats': {0}.",
healthMonitoringSection.EventMappings.Contains("HeartBeats"));
// Get the index of the 'HeartBeats' event in the EventMappings collection property.
Console.WriteLine("EventMappings index for 'HeartBeats': {0}.",
healthMonitoringSection.EventMappings.IndexOf("HeartBeats"));
// Get a named EventMappings
eventMappingSetting = healthMonitoringSection.EventMappings["HeartBeats"];
// Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Remove("HeartBeats");
// Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.RemoveAt(0);
// Clear all EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Clear();
' Add a EventMappingsSettings object to the EventMappings collection property.
Dim eventMappingSetting As EventMappingSettings = New EventMappingSettings( _
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web")
eventMappingSetting.Name = "All Errors"
eventMappingSetting.Type = _
"System.Web.Management.WebErrorEvent, System.Web"
eventMappingSetting.StartEventCode = 0
eventMappingSetting.EndEventCode = 4096
healthMonitoringSection.EventMappings.Add(eventMappingSetting)
' Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings( _
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web"))
' Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings( _
"Success Audits", "System.Web.Management.WebAuditEvent, System.Web", _
512, Int32.MaxValue))
' Insert an EventMappingsSettings object into the EventMappings collection property.
healthMonitoringSection.EventMappings.Insert(1, _
new EventMappingSettings("HeartBeats", "", 1, 2))
' Display contents of the EventMappings collection property
Console.WriteLine( _
"EventMappings Collection contains {0} values:", healthMonitoringSection.EventMappings.Count)
' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.EventMappings.Count - 1
eventMappingSetting = healthMonitoringSection.EventMappings(i)
Dim name As String = eventMappingSetting.Name
Dim type As String = eventMappingSetting.Type
Dim startCd As Integer = eventMappingSetting.StartEventCode
Dim endCd As Integer = eventMappingSetting.EndEventCode
Dim item As String = "Name='" & name & "', Type='" & type & _
"', StartEventCode = '" & startCd.ToString() & _
"', EndEventCode = '" & endCd.ToString() & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' See if the EventMappings collection property contains the event 'HeartBeats'.
Console.WriteLine("EventMappings contains 'HeartBeats': {0}.", _
healthMonitoringSection.EventMappings.Contains("HeartBeats"))
' Get the index of the 'HeartBeats' event in the EventMappings collection property.
Console.WriteLine("EventMappings index for 'HeartBeats': {0}.", _
healthMonitoringSection.EventMappings.IndexOf("HeartBeats"))
' Get a named EventMappings
eventMappingSetting = healthMonitoringSection.EventMappings("HeartBeats")
' Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Remove("HeartBeats")
' Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.RemoveAt(0)
' Clear all EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Clear()
The EventMappingSettings class corresponds to the eventMappings
configuration file element. The eventMappings
element allows you to assign friendly names to event sources. These names are then used to associate event sources with the related event consumers, called providers, in the rules
subsection of the healthMonitoring
section of the configuration file.
Event |
Initializes a new instance of the EventMappingSettingsCollection 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 EventMappingSettings object at the specified index location. |
Item[String] |
Gets the EventMappingSettings 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(Event |
Adds an EventMappingSettings 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 EventMappingSettings objects from the collection. |
Contains(String) |
Indicates whether the collection contains an EventMappingSettings 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 EventMappingSettings 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, Event |
Adds the specified EventMappingSettings object to the specified index point 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 an EventMappingSettings object from the collection. |
Remove |
Removes an EventMappingSettings object 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. |
Product | Versions |
---|---|
.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 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: