Why isn't 'post' a method of Dataflow.TransformBlock? Doesn't compile
-
02-07-2021 - |
Question
In examples on the web, I see that there is a method Dataflow.TransformBlock.Post()
, yet I can't get it to compile:
Dim q As New Dataflow.TransformBlock(Of Integer, Integer)(Function(x As Integer) As Integer
Return x
End Function)
q.post(5)
The error is:
'post' is not a member of 'System.Threading.Tasks.Dataflow.TransformBlock(Of Integer, Integer)'.
Solution
Post()
is an extension method, which means you need to import the TPL Dataflow namespace:
Imports System.Threading.Tasks.Dataflow
If you do that, you could also remove the Dataflow.
prefix from the block class name.
OTHER TIPS
According to MSDN this is only available in .NET 4.5 - perhaps you are using an older .NET version and/or not doing Imports System.Threading.Tasks.Dataflow
and/or don't reference System.Threading.Tasks.Dataflow.dll
in your project.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow