I’ve got this class:
class UrlManagementServiceClient : System.ServiceModel.ClientBase<IUrlManagementService>, IUrlManagementService
ClientBase implements IDisposable and ICommunicationObject. I’ve also got this interface:
interface IUrlManagementProxy : IUrlManagementService, ICommunicationObject, IDisposable
But I can’t cast UrlManagementServiceClient objects to IUrlManagementProxy. Is there some way to accomplish this? I want to end up with an object that can access all the methods on all three interfaces.
You can only cast to interfaces that you inherit from, to be able to cast to
IUrlManagementProxyyou need to implement that interface.You can then cast
UrlManagementServiceClientto eitherUrlManagementProxy,IUrlManagementService,ICommunicationObjectorIDisposable.Edit
The WCF-generated classes are partial, that means that you can extend the class definition in another file. Put
in another code file and your class will implement your full
IUrlManagementProxyinterface too and you can then cast it toIUrlManagementProxy.