从文本文件中获取一行 [英] Fetching a line from a text file
本文介绍了从文本文件中获取一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我叫Soumya.我正在ASP.Net(C#)中开发一个网站.我已经在APP/Temp文件夹中上传了一个文本文件.现在我想在按钮单击事件.方法和代码是什么?请帮帮我.
Hello my name is Soumya.I am developing a website in ASP.Net(C#).I have uploaded a text file in APP/Temp folder.Now i want to fetch the first line of the code in a string under a button click event.What will be the method and code?Please help me out.
推荐答案
这样的基本问题:
Such a basic question :
using(System.IO.StreamReader file =
new System.IO.StreamReader("filepath"))
{
while((line = file.ReadLine()) != null)
{
// Read the line
}
file.Close();
}
但我想让您先阅读基础知识....::rose:
But I want you to read the basics first .... :rose:
这篇关于从文本文件中获取一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文