zoukankan      html  css  js  c++  java
  • c#中获取路径方法

    要在c#中获取路径有好多方法,一般常用的有以下五种:

     

                //获取应用程序的当前工作目录。

                String path1 = System.IO.Directory.GetCurrentDirectory();            

                MessageBox.Show("获取应用程序的当前工作目录:" + path1);

      

                //获取程序的基目录。

                String path2 = System.AppDomain.CurrentDomain.BaseDirectory;        

                MessageBox.Show("获取程序的基目录:" + path2);

      

                //获取和设置包括该应用程序的目录的名称。

                String path3 = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;            

                MessageBox.Show("获取和设置包括该应用程序的目录的名称:" + path3);

      

                //获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称。

                String path4 = System.Windows.Forms.Application.StartupPath;           

                MessageBox.Show("获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称:" + path4);

      

                //获取启动了应用程序的可执行文件的路径及文件名

                String path5 = System.Windows.Forms.Application.ExecutablePath;           

                MessageBox.Show("获取启动了应用程序的可执行文件的路径及文件名:" + path5);

  • 相关阅读:
    页面整体布局思路
    CSS3转换、过渡、动画效果及css盒子模型
    CSS随笔
    CSS基础,认识css样式
    HTML基础表单
    HTML基础
    java.sql.SQLException: 调用中无效的参数DSRA0010E: SQL 状态 = null,错误代码 = 17,433
    There is no Action mapped for namespace / and action name accredit.
    myeclipse开启后卡死、building workspace缓慢 问题解决
    you need to upgrade the working copy first
  • 原文地址:https://www.cnblogs.com/nofliu/p/1695427.html
Copyright © 2011-2022 走看看