对象不采取价值对象、价值

由网友(失梦少年)分享简介:我很抱歉这个帖子的标题,但我不知道怎么形容我的问题。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 followin...

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

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.

阅读全文

相关推荐

最新文章