C#,怎样得到本文件当前所在路径?

来源:百度知道 编辑:UC知道 时间:2024/05/26 14:52:24
谢谢!

private void button1_Click(object sender, System.EventArgs e)
{
string strPath = Application.StartupPath;
textBox1.Text = strPath ;
}

生成后的exe文件在什么目录,strPath就是那个目录名

WinForm:同上;
WebForm:Server.MapPath("FileName");