Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extension methods in a data contract

Tags:

wcf

Can we two WCF services where one service contract derives from another and have an extension method inside the derived contract. what will be the result of accessing this contract from the WCF Client. I.e. what will happen if IDServiceis accessed E.g.

[ServiceContract]
public interface IBaseService
{
  public void A();
  ...
}

[ServiceContract]
public interface IDService: IBaseService
{
  public static void B(this IBaseService S);
  ....
}
like image 855
Webbhtz Avatar asked Feb 01 '26 02:02

Webbhtz


1 Answers

You can't define static methods in an interface (nor the access modifier public which you've specified above either).

like image 182
Matthew Abbott Avatar answered Feb 03 '26 09:02

Matthew Abbott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!