how do you open an input and read lines into a list of strings?

I need a method to read input to a list of strings.
asif07Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ColemssConnect With a Mentor Commented:
public class Readtextfile
{
public static int Main(string[] args)
{
StreamReader re = File.OpenText("Arungg.txt");
string input = null;
while ((input = re.ReadLine()) != null)
{
Console.WriteLine(input);
}
re.close;
return 0;
}
}
0
 
AUmidhCommented:

if you want to read from console
string strInput="DEF";
ArrayList lst=new ArrayList();
while(true)
{
strInput=Console.Readline();
if(strInput=="")
break;
lst.Add(strInput);
}
0
 
AUmidhCommented:
if you want to read in window based application.
using microsoft.Visualbasic;

string strInput="Default";
ArrayList lst=new ArrayList();
while(true)
{
strinput=Interactions.InputBox("prompt","title","default",5,5);
if(strinput==""
break;
lst.Add(strinput)
}
0
All Courses

From novice to tech pro — start learning today.