Code for .NET (C#)

As we work on various projects, we frequently end up writing bits of code that are not suitable as stand alone products, but have value to the community of developers, and perhaps even students that might be interested in how some of the bits work.

One of the things about the .NET platform, and C# in specific is the concept of extension methods[1]. Pretty much every language has supported models that allowed the for the ability to derive new complex types from existing types, but this model actually allows adding functionality to a type without creating a new derived class from it.

One place where we have run into frequently reused code was dealing with strings and formatting them to and from various output methods. So that led to the creation of our StringExtension.cs code. Another place was list views where we needed to do things with the content of those list views, which was the origin of ListViewExtension.cs and finally we had a couple of things we had to do repeatedly with Dates. Needless to say, you can predict this one, yes, it is DateExtension.cs.

In each case, we are putting the code into our repository on GitHub, and you can get it there, or you can bookmark here and keep up to date with the work here.

As we are moving the website, and Open Source work to github, not all of the projects are currently published. We will update this page as they become available.

  1. from MSDN Extension methods enable you to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.  ↩