取文件路径的父层目录 + 取后缀名


string dataDir = AppDomain.CurrentDomain.BaseDirectory;

if(dataDir.EndsWith(@"\bin\Debug\) || dataDir.EndsWith(@"\bin\Release\")){

  dataDir = System.IO.Directory.GetParent(dataDir).Parent.Parent.FullName;

}

string FileDir = dataDir;

 

 string hzm = System.IO.Path.GetExtension(FileDir);

 

posted on 2012-02-03 00:03  米高佐敦  阅读(205)  评论(0编辑  收藏  举报