c# - How to read by streamreader and sort -
i'm making passaparola game , @ end of game save nickname , score stream writer nickname;score
i'm trying make leaderboard dont know how sort them highest lowest @ or after saving.
also display them on labels wrote ;
string[] scorearray; string sc = sr.readline(); scorearray = sc.split(';'); label2.text = scorearray[0]; label3.text = scorearray[1];
which writes first line in text file.anyway how can sort , write them in labels ?
sort array , use foreach loop display results:
string[] scorearray; string sc = sr.readline(); scorearray = sc.split(';'); array.sort(scorearray); foreach (string s in scorearray) { //your code here. }
Comments
Post a Comment