请教微软的技术专家。一个完全不合理的问题!C#足够变态的问题!
当我这么写的时候
1:Type t = typeof (IOPCGroups);
2:int i;
3:i=Groups.Count;
系统会在运行到3:时出现
Object reference not set to an instance of an object.
异常。
而当我在第三句前加上i=(int)t.InvokeMember ("Count", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, Groups, new object [] {});
这句沃并未实际用到的话时,就正常了!
能告诉我为什么呢!
1:Type t = typeof (IOPCGroups);
2:int i;
21:i=(int)t.InvokeMember ("Count", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, Groups, new object [] {});
3:i=Groups.Count;
1:Type t = typeof (IOPCGroups);
2:int i;
3:i=Groups.Count;
系统会在运行到3:时出现
Object reference not set to an instance of an object.
异常。
而当我在第三句前加上i=(int)t.InvokeMember ("Count", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, Groups, new object [] {});
这句沃并未实际用到的话时,就正常了!
能告诉我为什么呢!
1:Type t = typeof (IOPCGroups);
2:int i;
21:i=(int)t.InvokeMember ("Count", BindingFlags.Public | BindingFlags.GetField | BindingFlags.GetProperty, null, Groups, new object [] {});
3:i=Groups.Count;
...全文
相关推荐
delphi WtsApi32.pas
delphi WtsApi32.pas delphi WtsApi32.pas delphi WtsApi32.pas
WtsApi32.pas
Windows Terminal Server SDK APIs
高校技术转移办公室如何实现科技成果的动态管理与多维分析?.docx
科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。
C语言程序设计教程(第6版)课件+例题源文件+习题答案
C语言程序设计教程(第6版)课件+例题源文件+习题答案
自动化生产线控制与维护(基于数字孪生)课件+联调总图+MCD和程序
自动化生产线控制与维护(基于数字孪生)课件+联调总图+MCD和程序


