I have an interface:
public interface: IA { ... }
and I try to extend it into
class public A : IA {
private static void foo(this IA a) {
a.foo();
}
}
but compiler says, that it can't find foo(), with first parameter of type IA. How can I fix it?
Have you marked your extension class as static as well? i.e. The class with the extension method must be marked as static AND the extension method itself must also be static.
public static class AExtensions : IA
{
public static void foo(this IA a) { a.foo(); }
}
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