解决方案 »

  1.   

    这判断不就是
    if(水果对象 is 苹果)
    else if(水果对象 is 苹果)
    else if(水果对象 is 苹果)
    难道我理解错意思了?
      

  2.   

    http://jingyan.baidu.com/article/b87fe19ebc5afd52183568fe.html
      

  3.   

    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();
      

  4.   

    不太明白你的意思
    typeof(水果).IsAssignableFrom(typeof(苹果))
    或者
    typeof(水果).IsInstanceOfType(实现了水果接口的类的实例) ?