servicecontract

Why do WCF services use interfaces as a Service Contract instead of an abstract class?

て烟熏妆下的殇ゞ 提交于 2019-12-01 04:44:13
问题 This is a question I got asked in an interview. When you create a WCF service, you get two files; "IService.cs" and "Service.cs". Why is it a class implementing an interface versus a class inheriting an abstract class. Don't reply saying that you cannot put a [servicecontract] attribute over the abstract class. I know you can only apply it to interfaces, but why? 回答1: One can implement more than one interface. One can only inherit a single abstract class. 回答2: WCF completely decouples the