对不起大家,借用首页位置讨教一个问题,在CSDN上都没有满意的答案,只能求教于博客园中的各位高手了,闲话少说,上代码
Code
1 using System;
2 using System.Collections.Generic;
3 using System.Collections;
4 using System.Text;
5
6 namespace ConsoleApplication1
7 {
8 class Program
9 {
10 static void Main(string[] args)
11 {
12 IList<object> testG = new List<object>();
13 IList test = new ArrayList();
14
15 Console.WriteLine("testG is IList:{0}",(testG is IList));
16 Console.WriteLine("test is IList<object>:{0}", (test is IList<object>));
17 Console.WriteLine("test is IList<string>:{0}", (test is IList<string>));
18
19 Console.Read();
20 }
21 }
22 }
这段代码的返回结果是:
testG is IList:True
test is IList <object>:False
test is IList <string>:False
查了一下MSDN,IList和IList<T>没有什么继承关系,但是这段代码的结果很出乎意料,请各位高手帮忙分析一下原因,谢谢~~~~~