使用System.IO下的Path类:
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemiopathclasstopic.aspPath.GetExtension() 方法分析您传递给它的字符串,并且从该字符串返回扩展名
http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemiopathclasstopic.aspPath.GetExtension() 方法分析您传递给它的字符串,并且从该字符串返回扩展名
int pos = FileName.LastIndexOf(".");
string FileType = FileName.Substring(pos);
c:\my.test\file
楼上和楼上上的方法不就有问题了?
int pos = FileName.LastIndexOf(".");
string FileType = FileName.Substring(pos);
string ext=fi.Extension
string Extension = fio.Extension();or string Extension =Path.GetExtension(@"f:\123\12345.html");