I\'ve seen some code that uses the keyword this
in the function parameter declaration. For example:
public static Object SomeMethod( this Object
It is how you declare an extension method.
This means that you can invoke SomeMethod with .SomeMethod
for any object. The object before the .
will be the blah parameter.
string s = "sdfsd";
Object result = s.SomeMethod(false);
The extension method will be available on all types inheriting from the type of the this
parameter, in this case object. If you have SomeMethod(this IEnumerable
it will be available on all IEnumerable
:s like List
.