I use following code to store data in an array, then print it out.
Person[] people = {new Person( "Loki", "Lo", "Asgard", 2050),
new Person( "Thor", "Th", "Asgard", 2050),
new Person( "Iron", "Man", "Il", 4050),
new Person( "The", "Hulk", "Green", 1970)};
Now I want to read from a textline with those information and use the same array. How to?
The txt file looks like this
The Hulk Green 1970
Iron Man Il 4050
Thor Th Asgard 2050
Loki Lo Asgard 2050
I’m thinking about storing the words in a string array and then use [0], [1] and so on for each word. But a loop would cause a problem because I only want to use one “person”. Any suggestions?
here is a solution without using Linq