C# 删除文件:///在文件夹路径之前

C# 删除文件:///在文件夹路径之前,c#,string,path,C#,String,Path,我有这个密码 string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); 这将生成一个字符串,如 "file://C://Foo//bin" 我想要的是 "C://Foo//bin" 如何在不从一开始手动删除file://的情况下获得该文件?使用子字符串 string path = Path.GetDirectoryName(Assembly.Get

我有这个密码

string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
这将生成一个字符串,如

"file://C://Foo//bin"
我想要的是

"C://Foo//bin"
如何在不从一开始手动删除file://的情况下获得该文件?

使用子字符串

            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
        this.Text = path.Substring(6, path.Length - 6);
还是用这个

this.Text = Application.StartupPath;

抱歉,如果我完全误解了,Application.StartupPath难道不能满足您的需要吗?path=path.Replacefile://,。手动删除它有什么问题吗?OP问他如何在不手动删除的情况下实现这一点。