日期:2014-05-18 浏览次数:20797 次
string s = "3242615284293"; int[] times = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach (char c in s) times[int.Parse(c.ToString())]++; string r = ""; for (int i = 0; i < times.Length; i++) r += (string.Format("[{0}]:{1}; ", i, times[i])); textBox1.Text = r;
------解决方案--------------------
string str = "3242615284293"; textBox1.Text = new string(str.GroupBy(v1 => v1).OrderBy(v1 => v1.Count()).Reverse().Select(v1 => v1.Key).ToArray()); //24398516