static IEnumerable<KeyValue<char, int>> CountSymbols(string text) { var counter = new MyDictionary<char, int>(); foreach (var character in text) { int sequence = 0; if (counter.ContainsKey(character)) { sequence = counter.Get(character); } counter.AddOrReplace(character, ++sequence); } return counter; }