获得目录名称 - GetDirName

2017-02-26 15:54:38  访问(1485) 赞(0) 踩(0)


        /// <summary>
        /// 获得目录名称 - GetDirName
        /// </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;
        }


标签:获得目录名称 - GetDirName 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)