介绍几个ASP.NET中容易忽视但却很重要的方法函数
发布时间:2023-07-14 13:58:07 所属栏目:教程 来源:
导读:给大家介绍几个.NET中Path类的几个方法:
1. Path.combine(string, string)
根据给出的两个路径, 返回一个路径.
例如:
string CompletePath = System.IO.Path.Combine(@"c:/MyApp", @"Images
1. Path.combine(string, string)
根据给出的两个路径, 返回一个路径.
例如:
string CompletePath = System.IO.Path.Combine(@"c:/MyApp", @"Images
|
给大家介绍几个.NET中Path类的几个方法: 1. Path.combine(string, string) 根据给出的两个路径, 返回一个路径. 例如: string CompletePath = System.IO.Path.Combine(@"c:/MyApp", @"Images/skyline.jpg"); 将会返回一个全路径 c:/MyApp/Images/skyline.jpg 第一个参数中有无"/"结尾都可以. 2. Path.GetExtension(string) 返回给定文件路径的扩展名.例如: string FileExtention = System.IO.Path.GetExtention(@"C:/MyApp/Images/skyline.jpg"); 将会返回 "jpg" 3. Path.GetFileName(string) 给出文件名的全路径,返回文件名(包括扩展名).例如: string fileName = System.IO.Path.GetFileName(@"c:/MyApp/Images/skyline.jpg"); 将会返回"skyline.jpg" (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
