If you have a source, you can search for this Type identifier using regular expressions. Given the fact that it should be the first parameter of a function, something like this should do the trick:
\(this:b+:i:b+:i
At least in this way you can find out where extension methods are defined and add this namespace, and then rely on intellisense. Just ran this in a non-trivial project with many extension methods everywhere, and it worked. The only false positive was something like this:
if(this is Blah...
What we can fix by adding static to our search, since extension methods must be static:
static.*\(this:b+:i:b+:i
This will not work for such cases:
public static ExtensionMethod( this int iVal) { }
But such a limitation of regular expressions. I am sure that certain several bodies can tell you all about the pain of using regular expressions to analyze the language.
Now, which, it seems to me, is missing in the IDE, it is possible to recognize extension methods that are in an unimported namespace. Similar to how you know the name of a class, if you type it, the IDE will give you a hint to either use it explicitly or import the namespace. In the end, this is how I import all my namespaces and often try to do the same with extension methods.
source share