TAG:
<P>iTbulo.COM<BR> <BR>给大家介绍几个.NET中Path类的几个方法:</P> <P>1. Path.combine(string, string)<BR> 根据给出的两个路径, 返回一个路径.<BR> 例如:<BR> string CompletePath = System.IO.Path.Combine(@"c:\\MyApp", @"Images\\skyline.jpg");<BR> 将会返回一个全路径 c:\\MyApp\\Images\\skyline.jpg<BR> 第一个参数中有无"\\"结尾都可以.</P> <P>2. Path.GetExtension(string)<BR> 返回给定文件路径的扩展名.例如:<BR> string FileExtention = System.IO.Path.GetExtention(@"C:\\MyApp\\Images\\skyline.jpg");<BR> 将会返回 "jpg"</P> <P>3. Path.GetFileName(string)<BR> 给出文件名的全路径,返回文件名(包括扩展名).例如:<BR> string fileName = System.IO.Path.GetFileName(@"c:\\MyApp\\Images\\skyline.jpg");<BR> 将会返回"skyline.jpg" </P> (iwgh) |