获取程序的当前目录

String

 

 

strAppDir = Path.GetDirectoryName(

                       

 

Assembly.GetExecutingAssembly().GetName().CodeBase);

           

 

String strFullPathToMyFile = Path.Combine(strAppDir, "fileName.txt");

           

 

Console.WriteLine(String.Format("Path to the application is: '{0}'." +

               

 

"Full path to the file in the application folder is: '{1}'",

                strAppDir, strFullPathToMyFile));

posted @ 2011-12-06 15:32  xiaoshiyilang  阅读(114)  评论(0编辑  收藏  举报