开发者

insert values from txt toan 2-demensions array or Arraylist using c#

开发者 https://www.devze.com 2023-03-26 06:16 出处:网络
I am new in programming and want some help with this. I have to read a fixed length txt file, and to insert two values form each line in a two dimension arrayor arraylist. I think that the best chois

I am new in programming and want some help with this.

I have to read a fixed length txt file, and to insert two values form each line in a two dimension array or arraylist. I think that the best choise is the a dynamic array...

I have read the relative topics but it;s not clear to me yet...

Could give me some help please.

Than开发者_运维技巧k you in advance!

I cannot attach any code as I'am out of office know...


In order to read a text file line by line:

using (var file = File.OpenText("foo.txt"))
{
    string line;
    while ((line = file.ReadLine()) != null)
    {
        // line will contain the current line being read
    }
}

Then you could use a List<T> to hold the data being parsed from each line.

0

精彩评论

暂无评论...
验证码 换一张
取 消