Parallelisation in .NET 4.0 – Part 1 looping

In an upcoming project we have a need for using some parallelisation features. There are two aspects to this, one is that we have to make multiple calls out to a web service that can take some time to return and in the meantime we have to get data out of the CMS to match […]

Tip of the Day #19: Create a list of objects instead of many lists of values

I?ve been reviewing some code and I came across something that jars. What is wrong with this is many-fold. Essentially, instead of encapsulating an related data into an entity that describes the whole the developer had created silos of data values, and you’d better hope that nothing went awry with any of it. It looked […]

Updated chart of .NET version numbers

Way back when, I published a table detailing the version numbers of the various parts that make up a .NET application: The Tools, the C# language, the Framework itself and the Engine (CLR) that it all runs on. With the latest version about to be released I thought it was time to update that table. […]

Tip of the Day #17: Duplicate input fields

Don’t allow duplicate input fields into your form. The other day I was trying to debug a bug in an application that I maintain. The code created a set of pagination buttons at the top of the page with previous and next buttons. At some point a request had come in that the buttons needed […]

Tip of the Day #16: NaN (Not a Number)

The Issue If you want to detect if a double (System.Double) or float (System.Single) is ?not a number? or NaN you cannot use something like this: if (myDouble == double.NaN) { /* do something */ } It will always be false. Sounds crazy? Try this: double myDouble = double.NaN; Console.WriteLine(“myDouble == double.NaN : {0}”, myDouble […]

Tip of the day #13 (String Equality)

When comparing two strings in a case insensitive manner, use: myFirstString.Equals(mySecondString, StringComparison.InvariantCultureIgnoreCase) or, if cultural rules are to be ignored completely* then use: myFirstString.Equals(mySecondString, StringComparison.OrdinalIgnoreCase) over: myFirstString.ToLower() == mySecondString.ToLower() * The invariant culture is actually a non-region specific English language culture. The ordinal comparison is faster than any culture specific comparison as it uses a […]

How to get a value from a text box into the database

This question was asked on a forum and I took some time to construct a reasonably lengthy reply so I’m copying it to my blog for a bit of permanence. I suspect that many of my regular readers will be dismayed at the lack of proper architecture (e.g. layering) but we all had to start […]