Is there a way to easily parse file paths in portable class libraries?

后端 未结 2 780
南笙
南笙 2021-01-17 12:15

I\'m needing to parse a path into parts from within a portable class library and get things like the filename, extension, just directory name, etc.

All of these met

2条回答
  •  迷失自我
    2021-01-17 12:21

    I would use Uri class

    var segments = new Uri("file://c:/dir1/dir2/a.txt").Segments
    

    which is supported by PCL

    http://msdn.microsoft.com/en-us/library/system.uri.aspx

提交回复
热议问题