Dictionary<string, int> counter = new Dictionary<string, int>();
            foreach (string c in  数组)
            {
                if (counter.ContainsKey(c))
                {
                    counter[c]++;
                }
                else
                {
                    counter.Add(c, 1);
                }
                if (counter[max] < counter[c])
                    max = c;
            }

max为元素    counter[max]出现次数最多的元素出现的次数

 

相关文章: