string path = Path.GetDirectoryName(
Assembly.GetAssembly(typeof(MyClass)).CodeBase);
đầu ra:Làm thế nào tôi có thể loại bỏ 'file: \' Từ Value Return of Path.GetDirectoryName() trong C#
file: \ d: \ học \ cs \ test \ test. xml
gì là cách tốt nhất để trở lại chỉ d: \ học \ cs \ test \ test.xml
file:\\
sẽ ném ngoại lệ khi tôi gọi doc.Save(returnPath)
, tuy nhiên doc.Load(returnPath)
; hoạt động tốt. Cảm ơn bạn.
có thể trùng lặp của [Có phương pháp Khuôn khổ .NET để chuyển đổi URI tệp thành đường dẫn có ký tự ổ đĩa không?] (Http://stackoverflow.com/questions/278761/is-there-a-net-framework-method- for-converting-file-uris-to-path-with-drive-le) – nawfal