Dictionary<int, char> d = new Dictionary<int, char>(); int i=0; string s = "Welcome to china"; char[] c = new Char[s.Length]; foreach (var item in s) { d.Add(i, item); i++; } foreach (var n in d.Keys) { Console.WriteLine(n); } Console.ReadKey(); 统计 Welcome to china中每个字符出现的次数 不考虑大小写