When I try to create an extension method for the File class, I get an error telling me that I cannot do this because the class is static. However, I don't see why this stops the creation of an extension method, what implication is there?
Thanks
Extension methods are called on an instance of an object.
myObj.ExtensionMethod();
If you have a static class, you can't have an instance of it. Therefore, there's nothing to call the extension method on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With