read file
-
-
I would like to fill a class from a text file as struture: 1000, n, km 5 description and so on knowing that the two lines represents a line of Class then how to assign each value (1000, n ,...) for each variable in the class??? thank you in advance
-
Read the text file, parse the data, and add it to objects of your class. You can create your objects either by a constructor or by setters for specific properties. Which part of this are you having difficulty with?
It's time for a new signature.
-
in the parse the data where I have the problem, I used to read the file:
string[] lines = System.IO.File.ReadAllLines(@"file.txt");
foreach (string line in lines) { Console.WriteLine("\\t" + line); }
-
i d'ont know how to parse the data from de file line by line, if you can complete the code , thank you
tek 2009 wrote:
i d'ont know how to parse the data from de file line by line, if you can complete the code , thank you
Good try, but we are not here to write your programs for you. Take a look at the System.String[^] class and make use of some of its methods to get the results you are looking for. If you really don't know how to get started then try working through this book[^] which contains lots of useful tutorials.
It's time for a new signature.