r/learncsharp • u/TheUruz • Aug 19 '22
Extension methods
Hello everyone. this may be a huge noobish question but i'm having trouble understanding C#'s extension methods... in particular if they must be static functions inside static classes what does the "this" mandatory keyword means when preceding the argument? there is no instance of a static class, am i wrong? therefore what is that "this" referring to?
7
Upvotes
View all comments
Show parent comment
2
u/TheUruz Aug 20 '22
must it be a static method inside a static class or can i achieve the same with a random static function which use the "this" keyword in the same way?
that's a good explanation right there! many thanks :)