Tuesday, February 10, 2009

Creating overloaded methods with extension methods

I have an interface in an application.

I want the interface to be simple to implement so it basically contains one method that has a number of parameters.

I want the interface to be simple to use, so I have implemented a number of extension methods that will work as overloads for the method specified in the interface.

So far so good. My next wish is to make the interface generic. This is where the everything falls apart. Apparently you are not able to make extension methods on a generic type. Every time i come across such mismatch between part of the .Net framework I am very sad. I wish the next version could just be a little coherent. :(