title: Update C# From HashSet to Try.Parse
body: <p>The code works much better, thanks to the help I have been given here. Some of you suggested that I should use "TryParse", but I don't know how to use it properly in this code. Do you have any suggestions?</p>
  
  <pre><code>int i = 1;
  while (set.Count &lt; 10)
  {
  Console.Write("|Write number " + i + ": ");
  string input = Console.ReadLine();
  while (!int.TryParse(input, out number))
  {
   if (!set.Add(number)) //
  {
  Console.Write("Write a new unique number!");
  }
  else
  {
  i++;
  }
  </code></pre>