在.NET之间有什么区别:
In .NET what is the difference between:
Environment.CurrentDirectory
Directory.GetCurrentDirectory()
?
Environment.CurrentDirectory
Directory.GetCurrentDirectory()
?
当然, Environment.CurrentDirectory
是可以设置并获得一个属性。
Of course, Environment.CurrentDirectory
is a property which can be set and obtained.
还有没有其他的区别?
正如大卫说:他们做同样的事情。在内部,获得当 Environment.CurrentDirectory
,它会调用 Directory.GetCurrentDirectory
和设置环境时。 currentDirectory所
,它会调用 Directory.SetCurrentDirectory
。
As David says: they do the same thing. Internally, when getting Environment.CurrentDirectory
it will call Directory.GetCurrentDirectory
and when setting Environment.CurrentDirectory
it will call Directory.SetCurrentDirectory
.
只需选择一个最喜欢的,并用它去。
Just pick a favorite and go with it.