• How to convert between URI and normal file path:
    • Convert normal file path to URI: Uri uri = new Uri(@"c:\Documents\myfile");
    • Convert URI to normal file path: string normalPath = new Uri(uriPath).LocalPath;
  • How to get file name or file extension from URI or normal file path:
    • string fileName = Path.GetFileName(path); string fileExt = Path.GetExtension(path); // path can be both URI and normal file path.
    • FileInfo fi = new FileInfo(path);  string fileName = fi.Name; string fileExt = fi.Extension. // path can only be normal file path. Disadvantage: must need a FileInfo instance first.
posted on 2013-01-30 14:12  chuwachen  阅读(118)  评论(0)    收藏  举报