EventMappingSettingsCollection.Add(EventMappingSettings) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将 EventMappingSettings 对象添加到集合。
public:
void Add(System::Web::Configuration::EventMappingSettings ^ eventMappingSettings);
public void Add (System.Web.Configuration.EventMappingSettings eventMappingSettings);
member this.Add : System.Web.Configuration.EventMappingSettings -> unit
Public Sub Add (eventMappingSettings As EventMappingSettings)
参数
- eventMappingSettings
- EventMappingSettings
要添加到集合的 EventMappingSettings 对象。
例外
集合中已经存在要添加的 EventMappingSettings 对象或该集合为只读。
示例
下面的代码示例说明如何使用 Add 方法。 此代码示例是为类提供的大型示例的 HealthMonitoringSection 一部分。
// 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 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)
注解
集合不能包含 EventMappingSettings 具有相同名称的对象。