获得目录名称

2014-10-24 16:14:43  访问(1791) 赞(0) 踩(0)


        /// <summary>
        /// 获得目录名称
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static string GetDirName(string fileName)
        {
            if (fileName == null || fileName.Length == 0)
            {
                throw new Exception("string fileName为空。");
            }

            return new FileInfo(fileName).Directory.Name;
        }


标签:获得目录名称 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)