System.IO.FileInfo f = new System.IO.FileInfo("c:\aaa.xxx"); MessageBox.Show(f.Extension); 转载于:https://www.cnblogs.com/hzuIT/articles/475750.html