IList继承了ICollection,Count是ICollection的成员。
假如有代码:
string[] s = new string[10];
IList list = s as IList;
ICollection col = s as ICollection;
// 运行时,在vs.net开发环境的命令窗口中,察看list.Count时,会报错。
// 察看col.Count却正常。
int listCount = list.Count;
int colCount = col.Count;不论运行还是在命令窗口中察看,上面两个变量的值都是正确的,也没有任何异常发生,这是为什么?
希望提供有依据的答案。一周内结贴,如果我没有搞忘的话:D
假如有代码:
string[] s = new string[10];
IList list = s as IList;
ICollection col = s as ICollection;
// 运行时,在vs.net开发环境的命令窗口中,察看list.Count时,会报错。
// 察看col.Count却正常。
int listCount = list.Count;
int colCount = col.Count;不论运行还是在命令窗口中察看,上面两个变量的值都是正确的,也没有任何异常发生,这是为什么?
希望提供有依据的答案。一周内结贴,如果我没有搞忘的话:D
大概是在调试器中只能访问当前接口明确定义的成员,继承来的接口都不能访问。
结贴,免得搞忘了。