I'm a C# developer having worked with .Net since it was in beta. Before that I mainly worked in C and C++. I have been developing commercial software for more than 20 years. I also mess around with microprocessors, but that's just for fun. I live near Cambridge, England and work from home in my 'silicon shed'.

Blogroll

I was doing some simple load balancing tests on an application I'm building. I wanted to load multiple queues from different places in my code using a simple round-robin approach. A very simple thing to do, and this is what I came up with:

int index = 0, max = 10;

...

index += index >= max ? (index * -1) : 1;

...it will increment the index counter until it reaches the limit (10), then start back at zero again. I don't know why I find that line so beautiful, but I just do. I like it when you can do stuff in a single line of code.