对象没有价值 [英] Object doesn't take value

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

问题描述

我很抱歉这篇文章的标题,但我不知道如何描述我的问题。

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

所以,我有以下很简单代码:

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 ?为什么是null?

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

推荐答案

你在发布版本吗?如果在其他地方没有使用FileCount,则编译器可能会优化该变量。尝试在Debug构建中这样做。此外,这可能是由于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天全站免登陆