0

Consider this interface and class implementer

interface I
{
   string M() => "I.M()";
}

class C: I
{
   public string M()=>???.Replace("I","C");
}

Instead of ??? what is the way to invoke the default method? I've tried base.M(), but it wasn't a fan. And I've also tried base(I).M() and that didn't work.

Michael B
  • 7,512
  • 3
  • 31
  • 57
  • Does this answer your question? [C# 8 base interface's default method invocation workaround](https://stackoverflow.com/questions/59398027/c-sharp-8-base-interfaces-default-method-invocation-workaround) – Lance U. Matthews Apr 27 '20 at 21:43
  • The default implementation is there so you don't have to do anything with it. Clients can just do `new C().M();` If you want to *change* the implementation, you're free to do that also. – Rufus L Apr 27 '20 at 21:45

0 Answers0