Introducing CSharpSharp

Ever since C# 3.0 was released, I've been thinking about the possibilities opened by the extension methods. Extension methods allow developers to extend existing classes by providing them with additional methods. The beauty of this is that we can now create beautiful code APIs on existing classes without compromising its internal design. For example, an integer doesn't care about dates and time values, but it might be useful to specify values such as 1 year, 3 months, etc. Without extension libraries, you'd have to use the TimeSpan constructor like this:

var oneYear = new TimeSpan(1, 0, 0, 0, 0, 0);
var threeMonths = new TimeSpan(0, 3, 0, 0, 0, 0);

Not exactly pretty isn't it? With extension classes, this can now become:

var oneYear = 1.Years();
var threeMonths = 3.Months();

Much better.

I'm a strong believer into offering a developer friendly API when developing my own applications. Now that we have extension methods, I can bring the same level of quality to existing code. That's why I created CSharpSharp.

What is it?

CSharpSharp is a collection of extension methods and other classes grouped together in order to improve the API of the core of C#. The above example is only one of many other improvements I've implemented into the CSharpSharp libraries. The library is still relatively small, but I have plenty of other features ready to be added. The library is free to use for any project. I also plan on opening the source code depending on the feedback and reception in the developer community.

For more information, visit the project page, you'll also find a link to download the library (libraries actually, there's one specific for the Web).

If you would like to contribute to the project, I'm not looking for developer contributions right now, but I'm open to suggestions regarding new features.

Michel Billard's profile pictureMichel Billard's profile picture

A web developer's musings on software, product management, and other vaguely related topics.