Category Archives: Development

Registering a namespace for all Razor views

When you want use your own code generating classes like HtmlHelpers in a Razor view, you can register the namespace at the beginning of the Razor view like this: @using My.Custom.Namespace But what when you want to use a certain … Continue reading

Posted in Development | Tagged , | 2 Comments

Escaping curly braces in String.Format

Most of you will know that you can use String.Format to insert and format objects into a string. For example: int distance = 5; int time = 15; DateTime when = new DateTime(2011, 3, 7); string output = String.Format(“You have … Continue reading

Posted in Development | Tagged | Leave a comment

How to identify CMYK images in ASP.NET using C#?

I’m trying to create a small and reusable library to resize and save images in ASP.NET applications. Because some browsers can’t display CMYK images, I thought it would be nice to make my library convert CMYK images to RGB when … Continue reading

Posted in Development | Tagged , | 1 Comment

Anonymous types and the ItemDataBound event

As you will probably know, when you bind a list of items to a Repeater, you can then convert the DataItem to the type of that item in the ItemDataBound event of the Repeater like this: public class Person { … Continue reading

Posted in Development | Tagged | 2 Comments

Some of my extension methods

I’m really starting to appreciate extension methods. They provide an easy way to perform small common tasks you would usually put in static utility classes. Below you can find some I use regularly. The first two are extension methods to … Continue reading

Posted in Development | Tagged , | 1 Comment

First look at EF Magic Unicorn

A few days ago, Microsoft released CTP4 of the Entity Framework Feature. In his blog post demonstrating the new features of the EF CTP4, Scott Hanselman proposed a better name than the official “Microsoft ADO.NET Entity Framework Feature 4″: “EF … Continue reading

Posted in Development | Tagged | 3 Comments

Is formatting strings in a View evil?

Yesterday, I ran into an interesting post by Chris Brandsma about his personal rules when dealing with Views in ASP.NET MVC. While he sure has some valid points, I don’t agree with everything he says in that post. Apparently, I’m … Continue reading

Posted in Development | Tagged | 1 Comment

Order on multiple fields with LINQ

This is one of the things I tend to forget when I need to order a list on multiple fields using LINQ. I often start with chaining OrderBy() methods, only to realize that that doesn’t work. When you do that, … Continue reading

Posted in Development | Tagged | Leave a comment

The plans for 2010 – Update

We’re halfway into 2010 already so it’s time for a little update about my plans for this year. Quite a few things have changed since the original post. Get certificated I have decided not to go for the MCTS 70-536 … Continue reading

Posted in Development | Tagged | Leave a comment

Game of Life in Javascript

Background A while ago, I discovered Jonh Conway’s Game of Life. Game of Life is a cellular automaton invented by the British mathematician John Horton Conway in 1970. A cellular automaton is an array (of one or more dimensions) of … Continue reading

Posted in Development | Tagged | 2 Comments