title: Validating a String in a Class List C#
body: <p>Im making a project in C# Console Application and it is a Sports Club Management Software for school. I created a Class List Athletes and I got several paramenters, one of it is the Athlete's ID... My question is, when I choose the "Add Athlete" option, how can I check if there´s already an ID in the whole list. You probably thinking: "Ohh... Well its preety ez, just a do while, and a for method in it and use the Contain method..." Well Ive tryed that and I didn't quite got it... Ive been programming for some months now... Its not that I am a very skilled programmer but :/ ... </p>
  
  <ol>
  <li><p>This is what I tryed doing:</p>
  
  <pre><code>    do
      {
          for (int i = 0; i &lt; Athletes.Count; i++)
          {
              if (Athletes[i].id.Contains(id))
              {
                  Console.WriteLine("ID already exists, please insert another ID!");
                  Console.WriteLine();
                  Console.Write("Id: ");
                  id = Console.ReadLine();
              }
          }
      } while (Athletes[i]);
  </code></pre></li>
  </ol>
  
  <p>the thing is, as you can see, I cant use the [i] in the do while what makes it impossible to go through the list. I thought about getting a boolean but Im not really into booleans. Its probably a preety ez to fix problem but I really cant figger it out. Thanks guys. :)</p>