共用方式為


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

適用於

另請參閱