DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Reading A Text File With StreamReader
private void ImportCountries()
{
string delimiter = ",";
string fileName = @"c:\countrylist3.csv";
StreamReader sr = new StreamReader(fileName);
try
{
while (sr.Peek() >= 0)
{
string r = sr.ReadLine();
string[] items = r.Split(delimiter.ToCharArray());
}
}
finally
{
sr.Close();
}
}





