Introducing "Dallas"

Rx and MEF are my two favourite new additions to the v4 BCL. Just awesome to see so much care, thought and love going into the platform.
Could you (would you) use RX for file or socket I/O?
If so how would you compare it to IO Completion Ports?
As Rx is a library to orchestrate, not perform asynchronous operations, you would use the Async IO features from .NET and use Rx to react to the completion of the IO:
standard async IO:
var fs = new FileStream(@"d:\temp\test.txt", FileMode.Open, FileAccess.Read, FileShare.Read, 1, true); var data = new byte[fs.Length]; fs.BeginRead(data, 0, data.Length, (result) => { var bytesRead = fs.EndRead(result); Console.WriteLine("{0} bytes read.", bytesRead); }, null);
with Rx:
var fs = new FileStream(@"d:\temp\test.txt", FileMode.Open, FileAccess.Read, FileShare.Read, 1, true); var data = new byte[fs.Length]; var asyncRead = Observable.FromAsyncPattern<byte[], int, int, int>( fs.BeginRead, iasyncResult => fs.EndRead(iasyncResult)); var result = asyncRead(data, 0, data.Length); result.Subscribe(bytesRead => Console.WriteLine("{0} bytes read.", bytesRead));
Now this is a small sample, but the main difference is that in the latter, the result of the async operation is a first-class value. This means that you can pass the event stream around, do various operations on it (such as select, merge, selectmany, zip etc...), post the result to the UI thread, etc...
in a bit of shameless self promotion, check out my project
its a code generator that generate observable versions of various other things such as events
the generation doesnt quite work yet because i needed a release like this to make it work, but check back soon
a question, Rx is available for .net3.5 but it uses pfx, how does that work? is there a version of pfx included in the .net 3.5 release?
--edit--
yes it is
--edit2--
http://geny.codeplex.com/ has now been updated to wor with the new Rx release! there is still no release and im planning to backport it to vs2008 [might be trivial though] but the trunk is now able to create extension
methods that return observable methods from events
Awsome. I'm definatly going to check it out =)
Hey folks,
Where can we find the Rx dev labs? I've looked around (e.g. https://msdn.microsoft.com/en-us/aa570323.aspx) but can't find them anywhere!!
-Jamie
var task1 = Task.Create(_ =>
{
"Thanks for back porting TPL to 3.5!".WriteLine();
});
var task2 = Task.Create(_ => "Thanks for Rx Erik!".WriteLine());
Task.WaitAll(task1, task2);
"Thanks to all for these wonderful things!".WriteLine();
BTW - what happened to Task.Factory? I don't see factory class in these Rx 3.5 bits. But the docs are full of factory samples? What am I missing?
thanks J.
are you sure they're not in there?
they seem to bee in
%programfiles%\Microsoft Reactive Extensions\Redist\DesktopV2\System.Threading.dll
atleast, perhaps you have another version in the gac or something?
The correct version should be 1.0.2052.0
Very cool!
for an approach to turn dependency properties into Observables, check out this thread
https://channel9.msdn.com/posts/J.Van.Gogh/Writing-your-first-Rx-Application/
"The correct version should be 1.0.2052.0"
My version was 1.0.3058.34407 downloaded with the .Net 3.5 link. No Future either. I am guessing this backported version is slimmed down to just the bones they needed for Rx.
ok.. mine is 1.0.2052.0 atleast downloaded the 3.5 version on this box no more than an hour ago
maybe someone from the team can shed some light on this?
(wasnt Future replaced by Taks<T> by the way? )
Sounds like you have the June 2008 CTP version of Pfx installed on your machine, their version number was 1.0.3058.34407. Try going through your installed program list to see if it is still there by anychance and uninstall that before installing Rx...
"Sounds like you have the June 2008 CTP version of Pfx installed on your machine"
You sir are steely eyed missle man. That was the issue. Explains a lot of other things have been knocking head on.
I like the concept of explaining in 15 min. To the point. Keep up the good work
Brilliant and Interestingly Explained.
Thx for this Video !!!
Great video - my friend recommended Rx, and the penny dropped for the first time after watching this video.
Charles, Charles...