use*_*998 0 .net c# file-io directory-structure visual-studio-2010
假设我的Visual Studio C#Web应用程序中有一个像ClientBin这样的文件夹.
我很困惑@""将在以下试图创建目录路径的C#代码中执行什么操作:
String DirectoryPath = System.IO.Path.Combine(@"" + "ClientBin");
Run Code Online (Sandbox Code Playgroud)
或者说到fa文件,如下例所示:
String FilePath = System.IO.Path.Combine("admin", "access", @"" + "users.aspx");
Run Code Online (Sandbox Code Playgroud)
基本上,有人可以向我解释@""与System.IO.Path.Combine方法有什么关系吗?
@""是一个逐字字符串文字(也见http://msdn.microsoft.com/en-us/library/ms228362.aspx),这基本上意味着反斜杠和换行是逐字而不是解析.用法通常类似于@"\ClientBin"或@"[a-b]\*".告诉你的代码是使用它的方式是很荒谬的,因为@""和""都是空字符串,并且你可以通过写得到同样的结果"ClientBin".