c# - How to save data from an array -


i'm making simple application save school grades , displays when requested. how can save data not have reenter every time application run?

split problem lesser ones:

  • how save item to string in file
  • how read (parse) item from string (line) of file?

in case school grades ints:

int[] grades = new int[] {2, 3, 4, 5, 2}; 

the answers questions above can item.tostring() , int.parse(line) , can put

file   .writealllines(@"c:\mydata.txt", grades   .select(grade => grade.tostring())); 

and

int[] grades = file   .readlines(@"c:\mydata.txt")   .select(line => int.parse(line))   .toarray(); 

Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -