Category Archives: C#

Beyond LINQ: Sequence Generation in C#

I’m taking a post off from the Paint Wars posts, but I think this one is worth it. Many languages have nice syntactic sugar for creating a sequence of numbers. Usually, the syntax says something like: The expression "1..5" expands to the list "1, 2, 3, 4, 5". This syntax lets you do fun things […]

Also posted in Beyond LINQ, Functional | 5 Comments

The Code Behind Paint Wars: Object Oriented Design

This post is the second in a series of posts about the code behind PaintWars. In this series, I will be talking about how the design and implementation of the game differed in C# and F#.  Along the way, I’ll also be talking about some of the fun and exciting features of the F# language […]

Also posted in F#, Paint Wars, SrtInsights | Leave a comment

Paint Wars on Display at CodeMash

At the SRT Solutions booth at CodeMash this year, we will be showcasing Paint Wars, which is a Wii remote controlled game built on the XNA Framework.  The game was originally developed in C# during the Winter of 2007 by Sean Petty, Marshall Weir, and myself as our senior project at the University of Michigan.  […]

Also posted in F#, Paint Wars | Leave a comment

Default TypeConverters and Objects

Take a look at the following code. Which of the following tests do you think should pass? You might think that type converters could convert any type to an object, but you’d be wrong.  Value types or reference types, it doesn’t matter. All of these tests return false. Neither the object type converter nor any […]

Posted in C# | Leave a comment

Somebody call the Orkin man…

…because it looks like I just ran into a bug.  A compiler bug.  A while back I posted about Assert.ExpectedException, and how that style of exception testing is an improvement over the ExpectedException style.  Here’s the code as a reminder: Simple, right? Not exactly.  One would think that the following test would pass: Strangely, this […]

Posted in C# | 2 Comments

What’s Boost?

With so many languages, libraries, tools, frameworks, and Internet fads to keep up with, sometimes you let a few slip through the cracks.  This post is intended as an ultra quick primer (one of many) for anyone who let the Boost C++ libraries slip through the cracks.  If you have used Boost before, this post […]

Posted in C# | Leave a comment

Spice Up Your C# Code With Currying

[UPDATE: When I first posted this, I used the term currying  to describe partial function application. Though they are related concepts, they mean different things. Since this post is more about partial function application than currying, I have corrected the terminology below.] C# doesn’t have language supp1ort for currying, but that doesn’t mean that you […]

Also posted in Functional | Leave a comment

Testing for Exceptions in Unit Test Frameworks

In MSTest and nUnit, the typical way to test for exceptions is by using the [ExpectedException] attribute on a test method.  I’ve always found this to be a little annoying, but it was just recently that I decided to do something better.  Unsurprisingly, I’m not the first one to have this thought; xUnit uses this […]

Also posted in Unit Testing | 1 Comment