DataflowBlock.Post<TInput>(ITargetBlock<TInput>, TInput) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Posts an item to the ITargetBlock<TInput>.
public:
generic <typename TInput>
[System::Runtime::CompilerServices::Extension]
static bool Post(System::Threading::Tasks::Dataflow::ITargetBlock<TInput> ^ target, TInput item);
public static bool Post<TInput> (this System.Threading.Tasks.Dataflow.ITargetBlock<TInput> target, TInput item);
static member Post : System.Threading.Tasks.Dataflow.ITargetBlock<'Input> * 'Input -> bool
<Extension()>
Public Function Post(Of TInput) (target As ITargetBlock(Of TInput), item As TInput) As Boolean
Type Parameters
- TInput
Specifies the type of data accepted by the target block.
Parameters
- target
- ITargetBlock<TInput>
The target block.
- item
- TInput
The item being offered to the target.
Returns
true
if the item was accepted by the target block; otherwise, false
.
Remarks
This method will return once the target block has decided to accept or decline the item, but unless otherwise dictated by special semantics of the target block, it does not wait for the item to actually be processed. For example, ActionBlock<TInput> will return from Post as soon as it has stored the posted item into its input queue). From the perspective of the block's processing, Post
is asynchronous. For target blocks that support postponing offered messages, or for blocks that may do more processing in their Post
implementation, consider using SendAsync, which will return immediately and will enable the target to postpone the posted message and later consume it after SendAsync
returns.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈