介紹幾個ASP.NET中容易忽略的方法函數
來源:文萃谷 2.45W
給大家介紹幾個中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"