I would like to determine if a parameter has a modifier thisusing Reflection. I looked at the class properties ParameterInfobut could not find anything useful. I know that extension methods are just syntactic sugars, but I believe there should be a way to determine if a method is an extension method.
The only thing that distinguishes extension methods from other static methods (which are defined in a static public class) is the modifier this.
For example, this is not an extension method:
public static int Square(int x) { return x * x; }
But this:
public static int Square(this int x) { return x * x; }
So, how can I distinguish between two methods, using Reflectionor something else, if possible?