获得参数Null Exception,任何人都有解决方案? [英] Getting Argument Null Exception , anyone have solution?

查看:50
本文介绍了获得参数Null Exception,任何人都有解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

st2 = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
 resources = new ComponentResourceManager(Type.GetType(st2 +"\\Culture\\"+cultureName+"\\Excel.resx"));

推荐答案

如果不在您的环境中运行代码,我们无法分辨。 />
但是......可能,它与Path.GetDirectoryName有关 - 因为它返回整个路径但不包括最后一个'\'字符。

自Type.GetType不期望磁盘或文件夹规范,而只是它可能出现问题的命名空间信息 - 使用调试器准确隔离您传递给什么的内容,并查看文档是否有意义。有可能它没有。



但是,我不知道你到底想要用这个代码做什么 - 如果不知道的话它通常居住的背景!
Without running the code in your environment, we can't tell.
But...probably, it has to do with the Path.GetDirectoryName - since that returns the whole path up to but not including the last '\' character.
Since Type.GetType doesn't expect disk or folder specifications but just the namespace info that it probably where the problem is coming - use the debugger to isolate exactly what you are passing to what and see if it makes sense with the documentation. Chances are it doesn't.

But then, I'm not sure what the heck you are trying to do with that code anyway - it's not at all clear without the context it normally lives in!


这篇关于获得参数Null Exception,任何人都有解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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