BufferModesCollection.Add(BufferModeSettings) 方法

定义

BufferModeSettings 对象添加到集合中。

public:
 void Add(System::Web::Configuration::BufferModeSettings ^ bufferModeSettings);
public void Add (System.Web.Configuration.BufferModeSettings bufferModeSettings);
member this.Add : System.Web.Configuration.BufferModeSettings -> unit
Public Sub Add (bufferModeSettings As BufferModeSettings)

参数

bufferModeSettings
BufferModeSettings

要添加到集合的 BufferModeSettings 对象。

例外

集合中已经存在要添加的 BufferModeSettings 对象或该集合为只读。

示例

下面的代码示例说明如何使用 Add 方法。 此代码示例是为 HealthMonitoringSection 类提供的一个更大示例的一部分。

// Add a BufferModeSettings object to the BufferModes collection property.
BufferModeSettings bufferModeSetting = new BufferModeSettings("Error Log", 
    1024, 256, 512, new TimeSpan(0, 30, 0), new TimeSpan(0, 5, 0), 2);
bufferModeSetting.Name = "Operations Notification";
bufferModeSetting.MaxBufferSize = 128;
bufferModeSetting.MaxBufferThreads = 1;
bufferModeSetting.MaxFlushSize = 24;
bufferModeSetting.RegularFlushInterval = TimeSpan.MaxValue;
bufferModeSetting.UrgentFlushInterval = TimeSpan.Parse("00:01:00");
bufferModeSetting.UrgentFlushThreshold = 1;
healthMonitoringSection.BufferModes.Add(bufferModeSetting);
' Add a BufferModeSettings object to the BufferModes collection property.
Dim bufferModeSetting As BufferModeSettings = new BufferModeSettings("Error Log", _
    1024, 256, 512, new TimeSpan(0, 30, 0), new TimeSpan(0, 5, 0), 2)
bufferModeSetting.Name = "Operations Notification"
bufferModeSetting.MaxBufferSize = 128
bufferModeSetting.MaxBufferThreads = 1
bufferModeSetting.MaxFlushSize = 24
bufferModeSetting.RegularFlushInterval = TimeSpan.MaxValue
bufferModeSetting.UrgentFlushInterval = TimeSpan.Parse("00:01:00")
bufferModeSetting.UrgentFlushThreshold = 1
healthMonitoringSection.BufferModes.Add(bufferModeSetting)

注解

集合不能包含 BufferModeSettings 同名的对象。

适用于

另请参阅