I have a list of lines:
var TopScores=
list.Where(s => s.Score>2500)
.OrderBy(s => s.Score)
.Select(s => s.name)
.ToList();
var text= $"{"this is name of top score students"}\n{string.Join("\n", topScores)}"
I have:
this is name of top score students
jim
john
mary
What I need:
this is name of top score students
1-jim
2-john
3-mary
The problem is that the number of topScores is dynamic, how can I get the above list?
source
share