1

I recently posted a question on Using Delegates to simulate connected objects where I received a great answer on using the TPL DataFlow library to very easily and cleanly develop a solution to my application.

The problem is that I am stuck on .NET 3.5 or under for C#. I thought I might have been able to upgrade to .NET 4.5 be I cannot at this stage. As far as I've been able to determine I cannot retarget the Dataflow library to .NET 3.5 so my next solution is to look for a C++ alternative under a similar vein to that of TPL Dataflow - Its not the best scenario but I can compile C++ code to a DLL and import it to our C# application.

To summarize my requirements for a C++ library for this question:

  • I need to be able to connect nodes together in complex networks and pass units of a resource between them. Some of them will produce finite amounts of resource over time. Others will consume it at a specific rate.
Community
  • 1
  • 1
S.Richmond
  • 11,412
  • 6
  • 39
  • 57

1 Answers1

2

You might consider using mono's version of TPL Dataflow and compiling it yourself for .Net 3.5.

I think the biggest problem you'll encounter when trying to compile that code is that it relies heavily on TPL, which is not normally available for .Net 3.5. But it seems a backported version is available in older versions of Rx, so using that could work.

(Also, parts of the mono's version of TDF was written by me and I didn't receive pretty much any feedback about it, so it's quite certain there are bugs in there.)

Community
  • 1
  • 1
svick
  • 236,525
  • 50
  • 385
  • 514
  • This is great info. I now have TPL working in .NET 3.5. However I'm still struggling with compiling Dataflow against the .NET 3.5 TPL lib and whatever else it may need. Not really sure where to start there - Would I need to compile the entire Mono package or should I pull out that class into its own project and attempt to isolate it and compile it? – S.Richmond Apr 06 '13 at 12:03
  • @S.Richmond I think you should take the TPL Dataflow project and compile only that. The project itself should compile fine against MS .Net 4.5 and so compiling it against .Net 3.5 should be (mostly?) a matter of including TPL. – svick Apr 06 '13 at 12:12
  • So close now! I had to include a number of .Net v4 classes from the mono project but everything is compiling so far up until I get some errors in the Dataflow syntax. I assume this is due to minor differences in implementation. I'm researching how to patch them now but would love your input. Here are the errors and associated code: http://pastebin.com/iNSHCVHq – S.Richmond Apr 06 '13 at 12:47
  • @S.Richmond These two methods are new in TPL in .Net 4.5. It relatively simple to create your own versions of them: [`FromResult()` by using `TaskCompletionSource`](http://stackoverflow.com/a/4246063/41071) and [`WhenAll()` using `ContinueWhenAll()`](http://stackoverflow.com/a/11512998/41071). – svick Apr 06 '13 at 13:07