HealthMonitoringSection.BufferModes 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得指定緩衝模式之設定的物件集合。
public:
property System::Web::Configuration::BufferModesCollection ^ BufferModes { System::Web::Configuration::BufferModesCollection ^ get(); };
[System.Configuration.ConfigurationProperty("bufferModes")]
public System.Web.Configuration.BufferModesCollection BufferModes { get; }
[<System.Configuration.ConfigurationProperty("bufferModes")>]
member this.BufferModes : System.Web.Configuration.BufferModesCollection
Public ReadOnly Property BufferModes As BufferModesCollection
屬性值
BufferModesCollection 物件的 BufferModeSettings 集合。
- 屬性
範例
下列程式碼範例示範如何使用 BufferModes 屬性。 此程式碼範例是針對 類別提供的較大範例的 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.
healthMonitoringSection.BufferModes.Add(new BufferModeSettings("Error Log",
1024, 256, 512, new TimeSpan(0, 30, 0), new TimeSpan(0, 5, 0), 2));
// Display contents of the BufferModes collection property
Console.WriteLine("BufferModes Collection contains {0} values:",
healthMonitoringSection.BufferModes.Count);
// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.BufferModes.Count; i++)
{
bufferModeSetting = healthMonitoringSection.BufferModes[i];
string name = bufferModeSetting.Name;
int maxBufferSize = bufferModeSetting.MaxBufferSize;
int maxBufferThreads = bufferModeSetting.MaxBufferThreads;
int maxFlushSize = bufferModeSetting.MaxFlushSize;
TimeSpan regularFlushInterval = bufferModeSetting.RegularFlushInterval;
TimeSpan urgentFlushInterval = bufferModeSetting.UrgentFlushInterval;
int urgentFlushThreshold = bufferModeSetting.UrgentFlushThreshold;
string item = "Name='" + name + "', MaxBufferSize = '" + maxBufferSize +
"', MaxBufferThreads = '" + maxBufferThreads +
"', MaxFlushSize = '" + maxFlushSize +
"', RegularFlushInterval = '" + regularFlushInterval +
"', UrgentFlushInterval = '" + urgentFlushInterval +
"', UrgentFlushThreshold = '" + urgentFlushThreshold + "'";
Console.WriteLine(" Item {0}: {1}", i, item);
}
// Get a named BufferMode
bufferModeSetting = healthMonitoringSection.BufferModes["Error Log"];
// Remove a BufferModeSettings object from the BufferModes collection property.
healthMonitoringSection.BufferModes.Remove("Error Log");
// Clear all BufferModeSettings object from the BufferModes collection property.
healthMonitoringSection.BufferModes.Clear();
' 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)
' Add a BufferModeSettings object to the BufferModes collection property.
healthMonitoringSection.BufferModes.Add(new BufferModeSettings("Error Log", _
1024, 256, 512, new TimeSpan(0, 30, 0), new TimeSpan(0, 5, 0), 2))
' Display contents of the BufferModes collection property
Console.WriteLine("BufferModes Collection contains {0} values:", _
healthMonitoringSection.BufferModes.Count)
' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.BufferModes.Count - 1
bufferModeSetting = healthMonitoringSection.BufferModes(i)
Dim name As String = bufferModeSetting.Name
Dim maxBufferSize As Integer = bufferModeSetting.MaxBufferSize
Dim maxBufferThreads As Integer = bufferModeSetting.MaxBufferThreads
Dim maxFlushSize As Integer = bufferModeSetting.MaxFlushSize
Dim regularFlushInterval As TimeSpan = bufferModeSetting.RegularFlushInterval
Dim urgentFlushInterval As TimeSpan = bufferModeSetting.UrgentFlushInterval
Dim urgentFlushThreshold As Integer = bufferModeSetting.UrgentFlushThreshold
Dim item As String = "Name='" & name & "', MaxBufferSize = '" & maxBufferSize & _
"', MaxBufferThreads = '" & maxBufferThreads & _
"', MaxFlushSize = '" & maxFlushSize & _
"', RegularFlushInterval = '" & regularFlushInterval.ToString() & _
"', UrgentFlushInterval = '" & urgentFlushInterval.ToString() & _
"', UrgentFlushThreshold = '" & urgentFlushThreshold & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' Get a named BufferMode
bufferModeSetting = healthMonitoringSection.BufferModes("Error Log")
' Remove a BufferModeSettings object from the BufferModes collection property.
healthMonitoringSection.BufferModes.Remove("Error Log")
' Clear all BufferModeSettings object from the BufferModes collection property.
healthMonitoringSection.BufferModes.Clear()
備註
這是 物件的集合 BufferModeSettings ,定義在引發健康情況監視事件之前可緩衝處理的方式。
此屬性預設為空 BufferModesCollection 集合。