sorting - Sort a list of objects by parameters in c# -
i have list of users.
i'd sort list few parameters.
case 0: //date (work) int example: 0 osu_ve.userlist.sort((e1, e2) => e1.index.compareto(e2.index)); break; case 1: //name (work) string example: vectis osu_ve.userlist.sort((e1, e2) => e1.udata.username.compareto(e2.udata.username)); break; case 2: //pp (doesn't work) string example: 14688.76 osu_ve.userlist.sort((e1, e2) => convert.todouble(e2.udata.pp_raw).compareto(convert.todouble(e1.udata.pp_raw))); break; case 3: // best pp (doesn't work) string example: 820.545 osu_ve.userlist.sort((e1, e2) => convert.todouble(e2.ubestscore[0].pp).compareto(convert.todouble(e1.ubestscore[0].pp))); break; case 4: //rank (work) string example: 48484 osu_ve.userlist.sort((e1, e2) => convert.todouble(e1.udata.pp_rank).compareto(convert.todouble(e2.udata.pp_rank))); break; case 5: //country rank (work) string example: 54 osu_ve.userlist.sort((e1, e2) => convert.todouble(e1.udata.pp_country_rank).compareto(convert.todouble(e2.udata.pp_country_rank))); break; case 6: //acc (doesn't work) string example: 98.5678623 osu_ve.userlist.sort((e1, e2) => convert.todouble(e1.udata.accuracy.remove(5)).compareto(convert.todouble(e2.udata.accuracy.remove(5)))); break;
i error message: input string not in correct format.
few of them works. problem?
decimal mark needs dot , not comma.
https://msdn.microsoft.com/en-us/library/zh1hkw6k(v=vs.110).aspx
Comments
Post a Comment