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 集合。