BufferModesCollection 类

定义

BufferModeSettings 对象的集合。 此类不能被继承。

public ref class BufferModesCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.BufferModeSettings))]
public sealed class BufferModesCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.BufferModeSettings))>]
type BufferModesCollection = class
    inherit ConfigurationElementCollection
Public NotInheritable Class BufferModesCollection
Inherits ConfigurationElementCollection
继承
属性

示例

下面的代码示例演示如何使用该 BufferModesCollection 类型。 此代码示例是为类提供的大型示例的 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 对象用于定义事件提供程序的角色,例如关键、通知、分析和日志记录。 每个角色以不同的方式设置缓冲区模式事件。 例如,关键角色保留MaxBufferSizeMaxFlushSize小角色和UrgentFlushInterval属性,而 Analysis 角色将这些属性设置为更高的值。

构造函数

BufferModesCollection()

初始化 BufferModesCollection 类的新实例。

属性

AddElementName

在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与添加操作关联。

(继承自 ConfigurationElementCollection)
ClearElementName

在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与清除操作关联。

(继承自 ConfigurationElementCollection)
CollectionType

获取 ConfigurationElementCollection 的类型。

(继承自 ConfigurationElementCollection)
Count

获取集合中的元素数。

(继承自 ConfigurationElementCollection)
CurrentConfiguration

获取对顶级 Configuration 实例的引用,该实例表示当前 ConfigurationElement 实例所属的配置层次结构。

(继承自 ConfigurationElement)
ElementInformation

获取包含 ConfigurationElement 对象的不可自定义的信息和功能的 ElementInformation 对象。

(继承自 ConfigurationElement)
ElementName

获取在派生的类中重写时用于标识配置文件中此元素集合的名称。

(继承自 ConfigurationElementCollection)
ElementProperty

获取表示 ConfigurationElement 对象本身的 ConfigurationElementProperty 对象。

(继承自 ConfigurationElement)
EmitClear

获取或设置一个值,该值指定是否已清除集合。

(继承自 ConfigurationElementCollection)
EvaluationContext

获取 ConfigurationElement 对象的 ContextInformation 对象。

(继承自 ConfigurationElement)
HasContext

获取一个值,该值指示 CurrentConfiguration 属性是否为 null

(继承自 ConfigurationElement)
IsSynchronized

获取一个值,该值指示是否同步对集合的访问。

(继承自 ConfigurationElementCollection)
Item[ConfigurationProperty]

获取或设置此配置元素的属性或特性。

(继承自 ConfigurationElement)
Item[Int32]

获取集合中具有指定数字索引的 BufferModeSettings 对象。

Item[String]

根据集合中的指定键获取 BufferModeSettings 对象。

LockAllAttributesExcept

获取被锁定的特性的集合。

(继承自 ConfigurationElement)
LockAllElementsExcept

获取被锁定的元素的集合。

(继承自 ConfigurationElement)
LockAttributes

获取被锁定的特性的集合。

(继承自 ConfigurationElement)
LockElements

获取被锁定的元素的集合。

(继承自 ConfigurationElement)
LockItem

获取或设置一个值,该值指示是否已锁定该元素。

(继承自 ConfigurationElement)
Properties

获取属性的集合。

(继承自 ConfigurationElement)
RemoveElementName

在派生的类中重写时,获取或设置 ConfigurationElement 的名称,以便在 ConfigurationElementCollection 中与移除操作关联。

(继承自 ConfigurationElementCollection)
SyncRoot

获取用于同步对 ConfigurationElementCollection 的访问的对象。

(继承自 ConfigurationElementCollection)
ThrowOnDuplicate

获取一个值,该值指示尝试向 ConfigurationElement 添加重复的 ConfigurationElementCollection 是否会导致引发异常。

(继承自 ConfigurationElementCollection)

方法

Add(BufferModeSettings)

BufferModeSettings 对象添加到集合中。

BaseAdd(ConfigurationElement)

ConfigurationElementCollection 添加配置元素。

(继承自 ConfigurationElementCollection)
BaseAdd(ConfigurationElement, Boolean)

向配置元素集合添加配置元素。

(继承自 ConfigurationElementCollection)
BaseAdd(Int32, ConfigurationElement)

向配置元素集合添加配置元素。

(继承自 ConfigurationElementCollection)
BaseClear()

从集合中移除所有配置元素对象。

(继承自 ConfigurationElementCollection)
BaseGet(Int32)

获取位于指定索引位置的配置元素。

(继承自 ConfigurationElementCollection)
BaseGet(Object)

返回具有指定键的配置元素。

(继承自 ConfigurationElementCollection)
BaseGetAllKeys()

返回 ConfigurationElementCollection 中包含的所有配置元素的键数组。

(继承自 ConfigurationElementCollection)
BaseGetKey(Int32)

获取位于指定索引位置的 ConfigurationElement 的键。

(继承自 ConfigurationElementCollection)
BaseIndexOf(ConfigurationElement)

获取指定的 ConfigurationElement 的索引。

(继承自 ConfigurationElementCollection)
BaseIsRemoved(Object)

指示是否已从 ConfigurationElement 中移除具有指定键的 ConfigurationElementCollection

(继承自 ConfigurationElementCollection)
BaseRemove(Object)

从集合中删除 ConfigurationElement 对象。

(继承自 ConfigurationElementCollection)
BaseRemoveAt(Int32)

移除位于指定索引位置的 ConfigurationElement

(继承自 ConfigurationElementCollection)
Clear()

从集合中删除所有 BufferModeSettings 对象。

CopyTo(ConfigurationElement[], Int32)

ConfigurationElementCollection 的内容复制到数组。

(继承自 ConfigurationElementCollection)
CreateNewElement()

在派生的类中重写时,创建一个新的 ConfigurationElement

(继承自 ConfigurationElementCollection)
CreateNewElement(String)

在派生的类中重写时,创建新的 ConfigurationElement

(继承自 ConfigurationElementCollection)
DeserializeElement(XmlReader, Boolean)

从配置文件读取 XML。

(继承自 ConfigurationElement)
Equals(Object)

ConfigurationElementCollection 与指定的对象进行比较。

(继承自 ConfigurationElementCollection)
GetElementKey(ConfigurationElement)

在派生类中重写时获取指定配置元素的元素键。

(继承自 ConfigurationElementCollection)
GetEnumerator()

获取用于循环访问 IEnumeratorConfigurationElementCollection

(继承自 ConfigurationElementCollection)
GetHashCode()

获取表示 ConfigurationElementCollection 实例的唯一值。

(继承自 ConfigurationElementCollection)
GetTransformedAssemblyString(String)

返回指定程序集名称的转换版本。

(继承自 ConfigurationElement)
GetTransformedTypeString(String)

返回指定类型名称的转换版本。

(继承自 ConfigurationElement)
GetType()

获取当前实例的 Type

(继承自 Object)
Init()

ConfigurationElement 对象设置为其初始状态。

(继承自 ConfigurationElement)
InitializeDefault()

用于初始化 ConfigurationElement 对象的默认值集。

(继承自 ConfigurationElement)
IsElementName(String)

指示指定的 ConfigurationElement 是否存在于 ConfigurationElementCollection 中。

(继承自 ConfigurationElementCollection)
IsElementRemovable(ConfigurationElement)

指示是否可从 ConfigurationElement 中移除指定 ConfigurationElementCollection

(继承自 ConfigurationElementCollection)
IsModified()

在派生的类中重写时,指示从最后一次保存或加载此 ConfigurationElementCollection 后是否对其进行了修改。

(继承自 ConfigurationElementCollection)
IsReadOnly()

指示 ConfigurationElementCollection 对象是否为只读的。

(继承自 ConfigurationElementCollection)
ListErrors(IList)

将此 ConfigurationElement 对象以及所有子元素中无效属性的错误添加到传递的列表中。

(继承自 ConfigurationElement)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnDeserializeUnrecognizedAttribute(String, String)

获取一个值,该值指示反序列化过程中是否遇到未知特性。

(继承自 ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

导致配置系统引发异常。

(继承自 ConfigurationElementCollection)
OnRequiredPropertyNotFound(String)

找不到所需属性时引发异常。

(继承自 ConfigurationElement)
PostDeserialize()

反序列化后调用。

(继承自 ConfigurationElement)
PreSerialize(XmlWriter)

在序列化之前调用。

(继承自 ConfigurationElement)
Remove(String)

从集合中移除 BufferModeSettings 对象。

Reset(ConfigurationElement)

在派生的类中重写时,将 ConfigurationElementCollection 重置为其未被修改时的状态。

(继承自 ConfigurationElementCollection)
ResetModified()

在派生的类中重写时,将 IsModified() 属性的值重置为 false

(继承自 ConfigurationElementCollection)
SerializeElement(XmlWriter, Boolean)

在派生的类中重写时,将配置数据写入配置文件中的 XML 元素。

(继承自 ConfigurationElementCollection)
SerializeToXmlElement(XmlWriter, String)

当在派生类中实现后,将此配置元素的外部标记写入配置文件。

(继承自 ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

将属性设置为指定值。

(继承自 ConfigurationElement)
SetReadOnly()

IsReadOnly() 对象和所有子元素设置 ConfigurationElementCollection 属性。

(继承自 ConfigurationElementCollection)
ToString()

返回表示当前对象的字符串。

(继承自 Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

反转从配置层次结构的不同级别合并配置信息的效果。

(继承自 ConfigurationElementCollection)

显式接口实现

ICollection.CopyTo(Array, Int32)

ConfigurationElementCollection 复制到数组。

(继承自 ConfigurationElementCollection)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于

另请参阅