对象不采取价值 [英] Object doesn't take value

查看:168
本文介绍了对象不采取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很抱歉这个帖子的标题,但我不知道怎么形容我的问题。

I am sorry about the title of this post, but I've no idea how to describe my problem.

所以,我已经得到了以下非常简单的code:

So, I've got the following really simple code:

dynamic obj = new myClass(); // In my case it is a COM object
int FileCount = 0;
FileCount = obj.SomeMethod();

但在运行时我得到的是这样的:

But at runtime I get something like this:

怎么回事呢?为什么不是 Filecount = 0 ?为什么是空?

Whats going on there? Why isn't Filecount = 0? Why is it null?

推荐答案

您在发布版本?如果FileCount不使用别的地方所述变量可能由编译器进行优化的。尝试这样做,在调试版本。这也可以通过PDB文件不匹配造成的。清理所有的输出显示目录和重新编译应用程序。

Are you in Release build?. If FileCount is not used somewhere else the variable might be optimized out by the compiler. Try doing that in Debug build. Also this can be caused by pdb files mismatch. Clean all your output dirs and recompile the application.

这篇关于对象不采取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆