static public void UpdateUniversity(ref Dictionary <int, University> ListOfUniversities) { string NewName; Console.WriteLine("Please enter the University's ID․․"); var UIDasStr = Console.ReadLine(); int UID; while (!int.TryParse(UIDasStr, out UID)) { Console.WriteLine("This is not a number! Try again.."); UIDasStr = Console.ReadLine(); } if (ListOfUniversities.ContainsKey(UID)) { Console.WriteLine("Please enter the new University's name.."); NewName = Console.ReadLine(); bool allLetters; while (!(allLetters = NewName.All(c => Char.IsLetter(c))) || !(NewName.IsUpper())) { Console.WriteLine("Invalid name format! Try again.."); NewName = Console.ReadLine(); } ListOfUniversities[UID].Name = NewName; } else { Console.WriteLine("There is no University on this ID!"); } }