DataflowBlockOptions 类

定义

提供选项,用于配置数据流块执行的处理。Provides options used to configure the processing performed by dataflow blocks.

public ref class DataflowBlockOptions
public class DataflowBlockOptions
type DataflowBlockOptions = class
Public Class DataflowBlockOptions
继承
DataflowBlockOptions
派生

注解

备注

TPL 数据流库(System.Threading.Tasks.Dataflow 命名空间)不随 .NET 一起分发。The TPL Dataflow Library (the System.Threading.Tasks.Dataflow namespace) is not distributed with .NET. 若要在 Visual Studio 中安装 System.Threading.Tasks.Dataflow 命名空间,请打开项目,选择“项目”菜单中的“管理 NuGet 包”,再在线搜索 System.Threading.Tasks.Dataflow 包。To install the System.Threading.Tasks.Dataflow namespace in Visual Studio, open your project, choose Manage NuGet Packages from the Project menu, and search online for the System.Threading.Tasks.Dataflow package. 或者,若要使用 .NET Core CLI 进行安装,请运行 dotnet add package System.Threading.Tasks.DataflowAlternatively, to install it using the .NET Core CLI, run dotnet add package System.Threading.Tasks.Dataflow.

DataflowBlockOptions 是可变的,可以通过其属性进行配置。DataflowBlockOptions is mutable and can be configured through its properties.

如果未设置特定配置选项,将使用下列默认值:When specific configuration options are not set, the following defaults are used:

选项Options 默认Default
TaskSchedulerTaskScheduler Default
System.threading.tasks.dataflow.dataflowblockoptions.maxmessagespertaskMaxMessagesPerTask System.threading.tasks.dataflow.dataflowblockoptions.cancellationtoken (-1) DataflowBlockOptions.Unbounded (-1)
CancellationTokenCancellationToken None
BoundedCapacityBoundedCapacity System.threading.tasks.dataflow.dataflowblockoptions.cancellationtoken (-1) DataflowBlockOptions.Unbounded (-1)

数据流块在构造时捕获选项的状态。Dataflow blocks capture the state of the options at their construction. 对所提供的实例的后续更改 DataflowBlockOptions 不会影响数据流块的行为。Subsequent changes to the provided DataflowBlockOptions instance should not affect the behavior of a dataflow block.

构造函数

DataflowBlockOptions()

初始化新的 DataflowBlockOptionsInitializes a new DataflowBlockOptions.

字段

Unbounded

一个常数,用于为设置了上限的 DataflowBlockOptions 成员指定一个无限制的数量。A constant used to specify an unlimited quantity for DataflowBlockOptions members that provide an upper bound. 此字段为常数。This field is constant.

属性

BoundedCapacity

获取或设置可由块缓存的最大消息数量。Gets or sets the maximum number of messages that may be buffered by the block.

CancellationToken

获取或设置针对取消请求而要监视的 CancellationTokenGets or sets the CancellationToken to monitor for cancellation requests.

EnsureOrdered

获取或设置一个值,该值指示是否对块的消息处理强制执行按顺序处理。Gets or sets a value that indicates whether ordered processing should be enforced on a block's handling of messages.

MaxMessagesPerTask

获取或设置每任务可处理的最大消息数量。Gets or sets the maximum number of messages that may be processed per task.

NameFormat

获取或设置查询块的名称时要使用的格式字符串。Gets or sets the format string to use when a block is queried for its name.

TaskScheduler

获取或设置要用于该安排任务进度的 TaskSchedulerGets or sets the TaskScheduler to use for scheduling tasks.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于