c# - Reading from a file into a string array. Then .Split the code into 3 more arrays -


alright. i'm having problem. have load student data text files, , put them class called students.

so far-

const string student_file = @"c:users\etc\etc\students.txt"; students students = file.routines.loadstudents(student_file) 

then class fileroutines uses it's method

static public string [] loadstudents(string student_file) 

to read file line line , create string array each line. (this have far, wasn't given work with.)

string[] students  = file.readalllines(students_file); 

the instructions have "read lines in student input file, create student object each line. return students object contains array of students objects.

and end of all, array supposed end in students class. i'm supposed .split('\t') on students array , split 3 more arrays.

the file i'm working has data set so. 122338 weltzer teresa 123123 wang choo 123131 adams james 123132 binkley joshua 123139 howard tyler 123160 king alma

after code, it's supposed have 3 string arrays.

studentid[] lastname[] firstname[] 

i know kinda of ridiculous, , i'm asking lot. have looked everywhere, , can't figure out how it. i've seen how other ways, asked specific way. if can clarify more y'all, or if need add let me know. first post, go easy. thanks!

list students = new list(); string[] splitdata = students.split[" "]; int = 0; foreach(string s in splitdata) {     var student = new student();     student.studentid = splitdata[i++];     student.firstname = splitdata[i++];     student.firstname = splitdata[i++];     students.add(student); } 

does help?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -