Mat*_*lko 3 .net vb.net filesystems relative-path
鉴于我在路径中有一个文件:
C:\Applications\General Utils\Assembly1\Assembly1\Bin\Debug\Assembly1.dll
Run Code Online (Sandbox Code Playgroud)
我正在以下路径工作:
C:\Applications\Under Development\App1\App1\
Run Code Online (Sandbox Code Playgroud)
有一些简单的方法可以找到从应用程序到程序集的虚线路径:
..\..\..\General Utils\Assembly1\Assembly1\Bin\Debug\Assembly1.dll
Run Code Online (Sandbox Code Playgroud)
System.Uri uri1 = new Uri(@"C:\Applications\General Utils\Assembly1\Assembly1\Bin\Debug\Assembly1.dll");
System.Uri uri2 = new Uri(@"C:\Applications\Under Development\App1\App1\");
Uri relativeUri = uri2.MakeRelativeUri(uri1);
Console.WriteLine(relativeUri.ToString());
Run Code Online (Sandbox Code Playgroud)
应该做的伎俩
| 归档时间: |
|
| 查看次数: |
169 次 |
| 最近记录: |