How to read existing text files without defining path

后端 未结 8 1038
太阳男子
太阳男子 2020-12-14 05:53

Most of the examples shows how to read text file from exact location (f.e. \"C:\\Users\\Owner\\Documents\\test1.txt\"). But, how to read text files without writing full path

8条回答
  •  星月不相逢
    2020-12-14 06:15

    There are many ways to get a path. See CurrentDirrectory mentioned. Also, you can get the full file name of your application by using Assembly.GetExecutingAssembly().Location and then use Path class to get a directory name.

提交回复
热议问题