Extension methods are really useful - no two ways about it. Being able to add my own methods to an existing class makes for some very readable code.

Extension methods, however, are currently only instance methods. There's no syntax for defining a static extension method on a type rather than an instance. For example, suppose I wanted to define a static method called Yesterday() on the DateTime class, so I could do this:

var d = DateTime.Yesterday();

It's a trivial example, I know, but you get the idea. Another example might be to create a static method to create an instance of a type - like the TryParse() method we get on a few inbuilt classes.

I'm thinking that the syntax could use generics and look something like this:

public static DateTime Yesterday<this DateTime>()
return DateTime.Today.AddDays(-1);

So I've used the "this" keyword (in much the same way that normal extension methods do) except I've used it in the generic type argument. DateTime now has a static method called Yesterday.

Obviously static extension methods would only call static members (unless they take a parameter).

Perhaps C# 4.0 could introduce a feature like this. Would you use it?