Interface Inheritance
I am normally against having an interface inherit from another one, but there's a situation where I am in favor of it: web service interfaces!
The reason is that we can write code like this:
using (ChannelFactory<IMyService> factory = new ChannelFactory<IMyService>()){
using (IMyService svc = factory.CreateChannel()){
}
}
instead of:
using (ChannelFactory<IMyService> factory = new ChannelFactory<IMyService>()){
IMyService svc = factory.CreateChannel(); using (svc as IDisposable){
//the generated proxy does implement IDisposable!
}
}
I think this leads to more elegant code. I know there's a problem with using a ChannelFactory like this, and I will come back to it in a future post! :-)