# The Nullable Dot (Post-Xmas C# Wishes, Part 1)

Well Christmas, that traditional time for giving has just gone past. However the TechieSimon blog has nothing to give, apart from strange blog posts. So I thought I’d be cheeky instead. To somewhat belatedly celebrate the time of giving I’m going to do some (metaphorical) asking: For the next few blog posts I’ll talk about some of the things that I’d love Microsoft to add to the C# Language.

My first wish is for a nullable dot operator. Continue reading “The Nullable Dot (Post-Xmas C# Wishes, Part 1)”

# A Strange Binary Pattern

While I was writing the Maths for Programmers course, I was constructing some examples to illustrate overflow and noticed a strange pattern. I was working with the number 255, which is the biggest number that can be stored in an unsigned byte, and is represented in binary by 1111 1111. The idea was to use the unsigned byte data type and show the results of calculating 255 + 255 and 255 * 255 – both of those will cause an overflow.

Now 255 + 255 gives 510. And 255 * 255 gives 65,025. Look at what these numbers look like in binary. Continue reading “A Strange Binary Pattern”

# Zero Equals What???

Last time I asked you what the output would be from this code….

```try
{
checked
{
double zero = 0;
double minus = -1.0e-400;
double big = 1.0 / zero;
double minusBig = 1.0 / minus;

Console.WriteLine(zero == minus);
Console.WriteLine(big == minusBig);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
```

# The Two Types of Collection

When I was at university our very forward thinking lecturer (Dr Bacon as I remember) introduced us to the most amazing up-to-date programming environment: C on UNIX. Storing an item in a collection meant declaring an array, or if you are really being adventurous, using malloc to dynamically allocate memory. That was it. Back then it was practically state of the art. As well as making for the kind of excellent training that you curse at the time but realize 10 years later you should be eternally thankful for having been made to do it.

What a difference from today when the .NET Framework comes with so many collection classes out of the box that Continue reading “The Two Types of Collection”

# The Windows 8 Start Screen: Is It Really Evil?

When my partner (not a programmer) first saw the Windows 8 Start Screen, with all the big flashy icons, supposedly replacing the old Start Menu, her reaction was ‘wow cool!’ She was somewhat less amused 10 minutes later at the discovery that there was no convenient start button to click, and definitely irritated when she discovered how hard it had become to shut the computer down. She no longer uses Windows 8.
Continue reading “The Windows 8 Start Screen: Is It Really Evil?”

# Single Responsibility Apps

If you wrote a class that had more than one responsibility, chances are that your colleagues would be pouncing on it in your next code review, eagerly pointing out what a terrible programmer you are because you’ve broken the single responsibility principle. So if single responsibility is great for classes, why do we so happily accept apps and services that have more than one responsibility? Continue reading “Single Responsibility Apps”