Category Archives: C#

C# Async Examples in F# – Part 3

This post is the third of a series where I am converting the C# 101 Async Samples into F#. See below for the other entries in the series: C# Async Examples in F# – Part 1 C# Async Examples in F# – Part 2 The third async example deals with running operations in parallel. The […]

Also posted in Async, F# | 2 Comments

C# Async Examples in F# – Part 2

This post is the second of a series where I am converting the C# 101 Async Samples into F#. See below for the other entries in the series: C# Async Examples in F# – Part 1 C# Async Examples in F# – Part 3 The second C# Async example deals with making multiple asynchronous web […]

Also posted in Async, F# | 1 Comment

C# Async Examples in F# – Part 1

This post is the first of a series where I am converting the C# 101 Async Samples into F#. See below for the other entries in the series: C# Async Examples in F# – Part 2 C# Async Examples in F# – Part 3 Some of you may be familiar with my boss and C# […]

Also posted in Async, F# | 4 Comments

C# Expressions vs. F# Quotations: A Syntax Comparison

In C# the easiest and most common way to create an expression is by implicitly converting a single line lambda into an expression: This implicit conversion is great for some APIs, like the mocking library MOQ: When I use MOQ, I’m glad that the l => l.Count lambda automatically gets converted to an expression, but […]

Also posted in F# | Leave a comment

Revisiting Elevate: Seq.pairwise for C#

I’ve been working on a few different projects over the last few months including some work outside of the .NET space. This has been good for my clients, but not so good for Elevate. Fortunately, I found some time the other day to add a new feature: a pairwise implementation for C#. In F#, the […]

Also posted in Elevate, F# | Leave a comment

Don’t Misuse Lambdas

Avoid Duplicating Code It’s great that so many C# and VB.NET developers are taking advantage of LINQ. Unfortunately, using LINQ can encourage you to misuse lambdas. Consider the following simple example: Square is a useful utility function. It shouldn’t be defined as a lambda because that ensures code duplication instead of reuse. It’s more obvious […]

Also posted in F#, Functional | 17 Comments

It’s Beta For a Reason!

Today, I was in the process of creating a branch of Elevate to support .NET 4.0 when I came across a subtle, but breaking change in the Enumerable.Count function. The following code works in .NET 3.5, but fails in .NET 4.0 Beta 2: The Enumerable.Count method in .NET 4.0 Beta 2 fails to recognize that […]

Also posted in Elevate, Framework Bugs, Visual Studio | Leave a comment

Option Types vs Nullable Types

Some of the feedback that we’ve received about Elevate has to do with Option types and how they are different or similar to Nullable types in C#. Luke Hoban does a great job of describing some of the differences here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=470052 If you’ve played around with Option types in F# or another functional language, you […]

Also posted in Elevate, F#, Functional | 4 Comments

Introducing Elevate

The past few weeks, a few other SRT Solutions developers and I have been working on a new open source library called Elevate. We went public with the source on CodePlex this weekend, and although we’re still in the early stages of development, I already rely on many of the functional programming features of the […]

Also posted in Elevate, F#, Functional, SrtInsights | 56 Comments

F# For C# Programmers: Programming In the Small

During CodeMash this past January, I had the opportunity to talk with Chris Smith about F#. One of the things that he considered to be a sweet spot for the language was programming “in the small”. At the time, I didn’t completely agree with his claim, but after writing more F# and functional C# code, […]

Also posted in F#, Functional | Leave a comment