Access interface methods without referring the class

后端 未结 5 1079
礼貌的吻别
礼貌的吻别 2021-01-22 20:26

Say I have an Interface like this in a project called \"Interface\":

public interface TestInterface
{
    string Operation();
}

and class which

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 20:41

    You have interface so that your app can have plug in's..

    So basically you share your Interface dll to anyone who wants to make a plugin app for your app and then you can cast that new plugin class to the interface and invoke methods on it..

    If you dont cast the class to the interface,how on earth are you going to make the plugin class work for your app..

提交回复
热议问题