What is the difference between if and switch?

Although switch and if may seem to be two nearly-equivalent representations of the same concept, under the hood they function in two very different ways. Understanding the differences between the two makes for good general knowledge and provides one with an interesting glimpse at how the C# compiler works to optimise your code without you even knowing it.

Dragging and dropping files not working with Knockout.js

I recently encountered a problem when trying to implement drag and drop file uploads in a site I’m working on that uses Knockout.js. A simplified reproduction of the problem is as follows:

The performance advantage of generic type constraints

Have a look at the following two methods.

Different URI encoding formats in C#

Ever need to encode a string of text to make it web-compliant in some way but didn’t know which encoding function to use? I recently stumbled across a StackOverflow post where a user has provided a sample table of the different encodings provided by the HttpUtility and Uri classes in C# and thought I would share it here. As an example, this is what is provided for the greater-than sign (>):