Expand environment variable for My Documents

后端 未结 6 2107
星月不相逢
星月不相逢 2021-01-04 06:19

I know I can read environment variables like this:

Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

However, it would be r

6条回答
  •  -上瘾入骨i
    2021-01-04 07:14

    What exactly are you trying to do? Is there any reason why you can't just use Path.Combine?

    string docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    string foo = Path.Combine(docs, "Foo");
    

提交回复
热议问题