一句话 循环完 实现接口的方法 接口循环实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这判断不就是if(水果对象 is 苹果)else if(水果对象 is 苹果)else if(水果对象 is 苹果)难道我理解错意思了? http://jingyan.baidu.com/article/b87fe19ebc5afd52183568fe.html Apple a = new Apple();Banana b = new Banana();Pear p = new Pear(); //假设它们都实现 IDetectType接口,其中有 OutputType方法。IDetectType[] arr = new IDetectType { a, b, p };foreach (IDetectType item in arr) item.OutputType(); 不太明白你的意思typeof(水果).IsAssignableFrom(typeof(苹果))或者typeof(水果).IsInstanceOfType(实现了水果接口的类的实例) ? 輸入的字符如何按規格保存為一個記事本 Access2007 能否用ADO的 sqlDataAdapter吗 引用的问题 支付接口的实现 关于数据类型的问题。 dataGridView 值改变的事件出现的问题??? 打印的时候如何设定某段字符为竖打 在线请教:C++函数转换成C#写法 考考您的c基礎 大家快加入2846761java火拼.net&ruby webservice实体类跟对象实体类赋值的问题~~~~~~ C# form 程序 像weboffice一样在线编辑word和excel
if(水果对象 is 苹果)
else if(水果对象 is 苹果)
else if(水果对象 is 苹果)
难道我理解错意思了?
Banana b = new Banana();
Pear p = new Pear(); //假设它们都实现 IDetectType接口,其中有 OutputType方法。
IDetectType[] arr = new IDetectType { a, b, p };
foreach (IDetectType item in arr)
item.OutputType();
typeof(水果).IsAssignableFrom(typeof(苹果))
或者
typeof(水果).IsInstanceOfType(实现了水果接口的类的实例) ?