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

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -