Monthly Archives: May 2012

Going Round and Round

Did you think iteration was simple? Well, there’s more than one way to do it. For this example, let’s imagine we have a class called Provider. Let’s imagine it has a Get function which either returns the next item or

Posted in .NET

Many ways to implement similar logic

I blame this article for setting me off on this path. The article proposed some logger extensions, which resulted in some code a bit like this: There’s nothing majorly wrong with that, you might say. It uses a Func –

Posted in .NET, Duplication

Do it if you need it – Part 2 – Do it later

In the previous post we looked at wanting to pass in the method for evaluating the operand of a function, rather than passing in the operand itself. We imagined a logicService which might determine if the data is required from

Posted in .NET

Do it if you need it – Part 1 – Testing

I have been asked to explore the idea of supplying a function with some code to use if needed. The perfect example of this is the following: No matter whether debug logging is needed, the x.ToString() will be called in

Posted in .NET