Path.GetTempPath()方法可以返回null吗? [英] Can Path.GetTempPath() method return null?

查看:124
本文介绍了Path.GetTempPath()方法可以返回null吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我已浏览过MSDN文档: GetTempPath [ ^ ]方法。

方法是否有可能返回String.Empty?



谢谢,

Krushna

Hi,

I''ve gone through the MSDN document: GetTempPath[^] method.
Is there a chance that the method can return String.Empty?

Thanks,
Krushna

推荐答案

我原以为答案是'不'' - 因为列表中的最后一项(4)



1. TMP环境变量指定的路径。

2.路径指定的路径TEMP环境变量。

3. USERPROFILE环境变量指定的路径。

4.Windows目录。



应该始终指向一个有效的目录...



[已修改]我猜它可以测试 - 如果你有前三项中的任何/全部设置,取消设置并查看结果是什么



''g''
I would have thought the answer is ''no'' - since the last item on the list (4)

1.The path specified by the TMP environment variable.
2.The path specified by the TEMP environment variable.
3.The path specified by the USERPROFILE environment variable.
4.The Windows directory.

should always point to a valid directory ...

[modified] I guess it can be tested - if you have any/all of the first three items set, unset them and see what the result is

''g''


这篇关于Path.GetTempPath()方法可以返回null吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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