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
stringin 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
Post a Comment