如何关闭打开C#应用程序的文件

时间:2019-05-02 04:11:32

标签: c#

在添加了打开文件(.csv)应该关闭的数据后,我得到了代码

以下代码:

String filePath = Path.Combine(Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName,"fetching.csv");
String strSeperator=",";
StringBuilder sbOutput = new StringBuilder();

int env = Convert.ToInt32(textBox1.Text);
int user = Convert.ToInt32(textBox2.Text);
int pass = Convert.ToInt32(textBox3.Text);
int host = Convert.ToInt32(textBox4.Text);
int port = Convert.ToInt32(textBox5.Text);
int service = Convert.ToInt32(textBox6.Text);     

int[][] inaOutput = new int[][]{new int[]{env,user,pass,host,port,service}};
int ilength = inaOutput.GetLength(0);
for(int i=0;i<ilength;i++)
sbOutput.AppendLine(String.Join(strSeperator,inaOutput[i]));

File.AppendAllText(filePath,sbOutput.ToString()+"\n");

0 个答案:

没有答案