zoukankan      html  css  js  c++  java
  • C# 获取工作目录

     1 using System.Windows.Forms; // 添加库
     2 
     3 namespace WindowsFormsApp1
     4 {
     5     class DBHelper
     6     {
     7         public static void getDebugpath()
     8         {
     9             // 获取Debug的路径
    10             string debugpath = Application.StartupPath;
    11             // debugpath: F:C#_Project	est	est5WindowsFormsApp1WindowsFormsApp1inDebug
    12             string binpath = debugpath.Substring(0, debugpath.LastIndexOf("\"));
    13             // binpath: F:C#_Project	est	est5WindowsFormsApp1WindowsFormsApp1in
    14             string dbpath = binpath.Substring(0, binpath.LastIndexOf("\"));
    15             // dbpath: F:C#_Project	est	est5WindowsFormsApp1WindowsFormsApp1
    16             Console.WriteLine("debugpath: " + debugpath);
    17             Console.WriteLine("binpath: " + binpath);
    18             Console.WriteLine("dbpath: " + dbpath);
    19         }
    20         static void Main(string[] args)
    21         {
    22             GetConnection();
    23         }
    24     }
    25  
    26 }

    使用System.Windows.Forms中的Application.StartupPath

  • 相关阅读:
    Spark参数优化
    Spark性能优化指南
    Durid的特点
    优秀博客地址
    Kylin的特点
    2017/11/20
    堆、栈、静态存储
    arraylist 和 linkedlist 的区别
    青岛项目遇到的问题
    access specifier
  • 原文地址:https://www.cnblogs.com/uhanhi/p/12968606.html
Copyright © 2011-2022 走看看