How to get current working directory path c#?

后端 未结 7 1019
清歌不尽
清歌不尽 2020-12-15 15:08

I have a cursor file in project. I have given the absolute path in code i.e

F:/r.cur  

the problem is this is hard-coded path And i Want

7条回答
  •  粉色の甜心
    2020-12-15 15:40

    use Application.StartupPath returns path for the executable file that started the application.

            string pathCur = Path.Combine(Application.StartupPath, @"..\..\r.cur");
            Cursor = new Cursor(pathCur);
    

提交回复
热议问题