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.

4

2 回答 2

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

但是......为什么ArrayList?通用列表在 2013 年会更好!

于 2013-09-27T12:30:00.047 回答
1

尝试这个

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

但我强烈建议您不要使用 .net 1.0 或List<T>1.1ArrayList

List<string> list = new List<string>(File.ReadAllLines(path));
于 2013-09-27T12:31:58.863 回答