Answer the question
In order to leave comments, you need to log in
How to sort alphabetically?
There is a code, tell me, please, how to improve it so that you can sort the result (in the column on the right) alphabetically?
The code:
private void btnStat_Click(object sender, EventArgs e)
{
string text = tbReadText.Text;
string temp = "";
var groups = text.Where(char.IsLetterOrDigit).GroupBy(c => c);
foreach (var g in groups)
temp += "Символ: "+ g.Key +" - "+ g.Count()+ " раз"+"\r\n";
tbStat.Text = temp;
}
Answer the question
In order to leave comments, you need to log in
var groups = text.Where(char.IsLetterOrDigit).OrderBy(x => x).GroupBy(c => c);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question