Steve Fenton

Programming

You can subscribe to the Programming category micro-feed.

Most frameworks solve easy problems

As part of my ongoing punk software thought process, I found myself thinking about frameworks. The conclusion of these thoughts was, I suppose, inevitable if you work backwords. What I realised was that most frameworks solve easy problems. When you think about frameworks in this way, it becomes clear that though it may take some […]

C# namespace declarations

Unlike my recent article on Global Using Statement and Code Clues, the new namespace declarations have no trade offs and you should just auto-fix them in your whole project and move on with your life. Here’s how we do namespace before namespace declarations: namespace Fenton.Sample.UI { public class Example { } } …and here is […]

Stripping times from dates in C#

This is a surprisingly common problem in C#, where you need to take a DateTime and strip off the “time” bit to leave you with a representation of a day. Currently, you can do it by creating a new DateTime and passing only the parts you want to keep, like year, month, and day. DateTime […]

Type Coercion vs Type Conversion

The key difference between type coercion and type conversion is that type coercion is always implicit, whereas type conversion can be either implicit or explicit. In other words, “type conversion” refers to the general process of changing a type, whereas type coercion refers more specifically to the implicit conversion of a type. We can further […]

Counting a non-generic IEnumerable

You rarely come across them in 2021, but there is such a thing as a non-generic IEnumerable. They exist in System.Collections rather than System.Collections.Generic. Since .NET 2 pretty much everyone is full-on using generics as they are the best thing since curly-braces… but occasionally you find one and even more rarely you need to count […]