0

I want to get a ArrayList out of my intern txt file in App_Data Folder.

I have in my ASP.NET Application a App_Data Folder wit a file how this content:

P1
AS5050
GMS4010
GMS4020
GMS4030
GMS4030A
gateway
view_only
AS5050

and I want to get this list in a ArraList.

Tarasov
  • 3,625
  • 19
  • 68
  • 128

2 Answers2

2
var result = new ArrayList(File.ReadAllLines(pathToYourfile));

But... why an ArrayList ? Generic List would be better in 2013 !

Raphaël Althaus
  • 59,727
  • 6
  • 96
  • 122
1

Try this

ArrayList al = new ArrayList(File.ReadAllLines(path));

but I'll strongly recommend List<T> over ArrayList unless you're using .net 1.0 or 1.1

List<string> list = new List<string>(File.ReadAllLines(path));
Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189