查找接口的实现类 [英] Finding the implementing class for an Interface

查看:91
本文介绍了查找接口的实现类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在和Unity一起玩一些AOP事情,并且在...

I've been playing around with Unity to do some AOP stuff, and inside the...

public

推荐答案

如果您知道该类,只需尝试将其强制转换为


ICustomerService iCS = FactoryGetCS();

CustomerService cs = iCS作为CustomerService ;

if(cs!= null)//正确
{
cs.DeleteAllRecords(); //不在界面上.
}
If you know the class simply try to cast it such as


ICustomerService iCS = FactoryGetCS();

CustomerService cs = iCS as CustomerService;

if (cs != null) // Correct
{
   cs.DeleteAllRecords(); // Not on interface.
}


这篇关于查找接口的实现类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆