Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要检查两个相对文件路径是否相等。
String path1 = "a/b/c/file.txt"; String path2 = "/A/B/../B/C/file.txt";
实际上这两个路径指向同一个文件。但是我该如何检查呢?
PS:使用此处描述的方法对绝对路径执行此操作效果很好。
您可以使用Path.GetFullPath( MSDN ) 来比较文件的绝对路径。
Path.GetFullPath