Contents tagged with C#
-
F# and the Dynamic Lookup Operator ala C#
In the previous post, we covered various scenarios around how we’d make the syntax around using the MongoDB C# Driver a little nicer and less stringy. And before that we looked at using and abusing these so called dynamic lookup operators. In the F# language, we have the ability to define two “dynamic” operators, a get member operator denoted by the ( ? ), and the set member operator denoted by the ( ?<- ). The F# language and its associated libraries do not have an actual implementation of these operators, but instead allow you to implement them as you see fit. Previously, we tried two approaches…
-
Going Interactive with the Reactive Extensions
Lately in my series on the Reactive Extensions, you’ll have noticed I focused quite a bit on the IObservable<T> and IObserver interfaces as well as the extensions methods that are included. There is one thing, however, that might have been missed with the release of the Reactive Extensions is the inclusion of System.Interactive.dll. The idea behind this is to include many of the extension methods that are available to IObservable<T> and port them to work on the IEnumerable<T> interface.
-
Introduction to the Reactive Framework Part V
In the previous post of the Introduction to the Reactive Framework series, we covered how to create new IObservable<T> instances, either from scratch or from existing sequences. What this allowed us to do was turn an operation which was previously interactive, such as iterating over a collection, to a reactive, where I could have multiple listeners reacting to the same collection concurrently. This has nice implications for allowing us to scale our application in interesting ways. This time, let’s take another angle on making asynchronous programming easier.
-
Reactive Extensions for .NET (Rx) released on DevLabs
As you may have noticed, I’ve been blogging a bit about the Reactive Framework, now the Reactive Extensions for .NET (Rx) and how it will change the way we approach asynchronous and event-based programming. Just as LINQ to Objects changed the way we deal with collections, The Reactive Extensions will change the way we deal with asynchronous and event-based programming. Fast forward to today, Rx has been released on Microsoft DevLabs for not only .NET 4 Beta 2, but also .NET 3.5 SP1 and Silverlight 3 as well.
-
Introduction to the Reactive Framework Part IV
In the previous post in this series, we covered how to turn .NET events into first class values through IObservable instances. By doing so, we were able to do much more interesting things than just subscribe and unsubscribe, instead we were able to create a mouse drag event with little effort through composition. In this post, let’s look at going from push to pull by turning collections into IObservable<T> instances.
-
Introduction to the Reactive Framework Part III
In my previous post in the Introduction to the Reactive Framework series, I discussed the duality between the IEnumerable/IEnumerator and IObservable/IObserver and how that enables us to generalize the ideas from LINQ to Objects to LINQ to Observables/Events. After the last post, I was asked how we go from events to Observables, so let’s tackle that in this post.
-
Introduction to the Reactive Framework Part II
In my previous post, I talked a little bit about the parts of the Reactive Framework that are coming to the .NET 4 BCL as well as their implementation in F# as part of F# First Class Events. This time, let’s come back to the Reactive Framework itself from which the IObservable<T> and IObserver<T> originated. As you may remember, you can play with the bits of the Reactive Framework from the Silverlight 3 Toolkit.
-
Introducing the Reactive Framework Part I
During my series about first class events in F#, I made frequent mention of the LiveLabs Reactive Framework (Rx), without going into much detail as to what it is. Now that the series is complete and we understand both how F# first class events work, as well as their integration into F# async workflows, let’s take a look at the Reactive Framework in this multi-part series covering the history, implementation details and more.
-
Generically Constraining F# – Part I
Generic constraints inside .NET has always been a fun enterprise, especially given how C# handles them There has been some discussion on Jon Skeet’s blog about the fact that C# does not allow for generic constraints referring to a number of types. These include:
-
The “Anti-For” Campaign
Recently, there has been an effort launched called the “Anti-If Campaign” in which they deride the use of if statements and instead, focus on Object Oriented Principles in order to create more flexible designs. Now certainly, I have a sympathetic ear to this cause as I’ve seen code that literally walks off the side of the screen due to nesting of if statements. Pattern matching to me, especially at the top level of the function is actually quite beautiful in a way, such as the implementations in Haskell: