文件路径捷径

时间:2016-07-07 20:27:50

标签: c# asp.net

在这个方法中,我将excel文件保存在该路径的目录中,而不是编写整个路径,有没有办法让它变短以便自动保存在调试文件中?

using (var file = File.Open("C:\\Users\\john\\Documents\\Visual Studio 2015\\Projects\\EXCEl PROJECT\\webform\\" + filename + ".xlsx",FileMode.Create))
            {

                ms.WriteTo(file); // copy the memory stream to the file stream


            }

1 个答案:

答案 0 :(得分:0)

使用此属性作为基本目录。您可以根据需要附加。 @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2') import wslite.rest.* String key = 'my-key' def client = new RESTClient('https://maps.googleapis.com/maps/api/directions/') def response = client.get(path: 'xml', query: [ origin: 'Disneyland', destination: 'Universal Studios Hollywood', sensor: 'false', mode: 'driving', key: 'my-key' ]) println response.DirectionsResponse.status println response.DirectionsResponse.summary

样品:

System.AppDomain.CurrentDomain.BaseDirectory
相关问题