using System; using System.Linq; using System.Collections.Generic; class Player { public static Dictionary MyDic(int n) { Dictionary dic = new Dictionary(); Console.WriteLine("Введите имя : \n"); string s; for (int j = 1; j <= n; j++) { Console.Write("Имя{0} --> ", j); s = Console.ReadLine(); dic.Add(j, s); } return dic; } } class Program { public static void Main() { Console.Write("Сколько игроков добавить?"); int n = int.Parse(Console.ReadLine()); Dictionary dic = Player.MyDic(n); Console.Write("До какого считать?"); int k = int.Parse(Console.ReadLine()); ICollection keys = dic.Keys; while (keys.Count != 1) { for (int i = 1; i <= k; ++i) { if(i == k) { dic.Remove(i);//тут проблема :/ } } } foreach (int i in keys) { Console.Write("Остался:" + dic[i]); } } }