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 具有相同名稱的 物件。