給大家介紹幾個中Path類的幾個方法:
1. ine(string, string)
根據給出的兩個路徑, 返回一個路徑.
例如:
string CompletePath = ine(@"c:MyApp", @"Imagesskyline.jpg");
將會返回一個全路徑 c:MyAppImagesskyline.jpg
第一個引數中有無""結尾都可以.
2. xtension(string)
返回給定檔案路徑的副檔名.例如:
string FileExtention = System.IO.Path.GetExtention(@"C:MyAppImagesskyline.jpg");
將會返回 "jpg"
3. ileName(string)
給出檔名的全路徑,返回檔名(包括副檔名).例如:
string fileName = System.IO.Path.GetFileName(@"c:MyAppImagesskyline.jpg");
將會返回"skyline.jpg"