Posts about csharp

, , ,

Working with Ranges in a REST API

A unique way of working with ranges in a more fluent way in a REST API. What is nice about this approach is its easy to hook up to javascript and is still a valid url scheme.


Unit Testing in Linqpad

Linqpad is great for writing a quick test or exploring some api features. If you need to write a group of tests, you can use this quick little snippet to run Linqpad like a unit test.


Interface Anti-Patterns: The Vagrant

The proliferation of N-Tier architecture has caused a common anti-pattern with the use of interfaces in .NET applications. This anti-pattern often presents itself as a form of dependency injection (DI) with its usage intending to reduce the coupling between applications but often creates the exact opposite situation.


WPF Autogrid - Drop-in Replacement For Grid

A flexible, easy to configure replacement for the standard WPF Grid control Download WpfAutoGrid from Nuget. AutoGrid lets you reduce the amount of xaml when using grids for layout by allowing you to define rows and columns as simple properties and alleviating you from having to explicitly specify the row and column a child control belongs to. Partially based on work by Rachel Lim.

Oktoberfest 2012

This is a video board created for DuClaw Brewing Company to display what's on tap at the Maryland Brewer's Oktoberfest. Created to run on Xbox 360 or Windows 7 connected to a big ass Flat Panel television and a set of very loud speakers. The board also plays promotional videos on a set schedule and has a few more animations and effects not shown in this clip. The board actually runs on 3 different screens all with their own content, beer selection, videos, etc. We wrote the original for Oktoberfest 2009 and it gets updated each year. It's pretty much a giant video game written with XNA and C#.

Async Query and Batch with Entity Framework

When you're working with WPF or Windows forms one of the common issues that crops up is cross threading in your viewmodels. The following is a simple solution that wraps up a BackgroundWorker in some standalone classes that can be used with your DbContext. The nice thing about this solution is it doesn't require you to inherit any classes and you can stick the code in yuo project where you feel it works best.


Create a REST based HttpHandler in C#

Anytime I start a new project I’m usually super pumped to dive into some code and get something done. There I am, a cup of coffee and three energy drinks later, translating the latest business requirement into something simply amazing… or more likely, just another contact management application for the CEO of unnamed company X. But I’m happy, delightfully punching keys on the keyboard, slinging abstractions and enterprise patterns like its just another day. Just one more look at the functional spec and, wait, what is this? That’s right, I just realized that this is not a functional spec at all. This is Functional Spaghetti.


Using Dynamic Anonymous Types in Razor

A useful extension for developers that don’t shy away from anonymous types in their viewmodels.


XNA Multi Monitor Support

The information that follows pertains to an older version of XNA and may not be applicable Imagine an XNA game running two monitors, one for the 3d game, and a second having a full screen tactical map of the game. The easy part is actually splitting the game windows to multiple monitors, the difficult part is synchronizing the two parts to work together (which I will leave up to you). You can create a simple subclass of GraphicsDeviceManager and then create the two game windows on separate threads. When instantiating the Game class, pass in the index of the monitor you want to target (the index is visible in the display options dialog of your pc).