当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 介绍几个ASP.NET中容易忽略但却很重要的方法函数

ASP.NET
ASP.NET入门教程:ArrayList对象
ASP.NET入门教程:Hashtable对象
ASP.NET入门教程:SortedList对象
ASP.NET入门教程:把XML文件绑定到列表控件
ASP.NET入门教程:Repeater控件
ASP.NET入门教程:DataList控件
ASP.NET入门教程:数据库连接
ASP.NET入门教程:ASP.NET 2.0新特性
ASP.NET入门教程:ASP.NET 2.0母版页
ASP.NET入门教程:ASP.NET 2.0导航
ASP.NET入门教程:HTML服务器控件
ASP.NET入门教程:Web服务器控件
ASP.NET入门教程:Validation服务器控件
HTML服务器控件介绍:HtmlAnchor控件
HTML服务器控件介绍:HtmlButton控件
HTML服务器控件介绍:HtmlForm控件
HTML服务器控件介绍:HtmlGeneric控件
HTML服务器控件介绍:HtmlImage控件
HTML服务器控件介绍:HtmlInputButton控件
HTML服务器控件介绍:HtmlInputCheckBox控件

介绍几个ASP.NET中容易忽略但却很重要的方法函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-11   浏览: 54 ::
收藏到网摘: n/a

给大家介绍几个.NET中Path类的几个方法:

1. Path.combine(string, string)
根据给出的两个路径, 返回一个路径.
例如:
string CompletePath = System.IO.Path.Combine(@"c:\MyApp", @"/upload/tech/20091011/20091011143312_f2fc990265c712c49d51a18a32b39f0c.jpg");
将会返回一个全路径 c:\MyApp\/upload/tech/20091011/20091011143312_f2fc990265c712c49d51a18a32b39f0c.jpg
第一个参数中有无"\"结尾都可以.

2. Path.GetExtension(string)
返回给定文件路径的扩展名.例如:
string FileExtention = System.IO.Path.GetExtention(@"C:\MyApp\/upload/tech/20091011/20091011143312_f2fc990265c712c49d51a18a32b39f0c.jpg");
将会返回 "jpg"

3. Path.GetFileName(string)
给出文件名的全路径,返回文件名(包括扩展名).例如:
string fileName = System.IO.Path.GetFileName(@"c:\MyApp\/upload/tech/20091011/20091011143312_f2fc990265c712c49d51a18a32b39f0c.jpg");
将会返回"/upload/tech/20091011/20091011143314_5ef698cd9fe650923ea331c15af3b160.jpg"