If I have an interface:
public interface ISomething
{
void DoAThing();
}
Then I instantiate it with the ChannelFactory:
var channel = new ChannelFactory<ISomething>().CreateChannel
I get an instance I can use.
Now, to close it I need to cast:
((IClientChannel)channel).Close
or
((IChannel)channel).Close
or
((ICommunicationObject)channel).Close
My ISomething interface does not inherit any of these interfaces.
So what kind of an object did the CreateChannel method return and how did it construct a dynamic object that was capable of implementing an interface it had no idea about until run time?