title: How to repeat until the correct information is provided in c#?
body: <p>I am currently writing a program where I have to 
  1) Giving user some options: 1.Search by name? 2. Search by date of birth?
  2) If user selects search by name, ask them to put first name and then give the output
  3) If user selects search by date of birth, ask them to put date of birth with format (MM/DD/YYYY) and then give the output.</p>
  
  <p>I have to Repeat the options if the validation failed or couldn’t find the data.
  I am struggling with the concept of repeating the options. ANy help is extremely appreciated. </p>
  
  <p>My code so far</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Week2Tutorial
  {
  class Program
  
      class Student
      { 
          public int Id { get; set; }
          public string FirstName { get; set; }
          public string Lastname { get; set; }
          public DateTime DOB { get; set; }
          public string Gender { get; set; }
  
  
      }
  
  
      static void Main(string[] args)
      {
  
          var students = new List&lt;Student&gt;()
          {
              new Student() { Id = 1,FirstName = "Min Chul",Lastname = "Shin",DOB = new DateTime(2010,01,01),Gender = "Male"},
              new Student() { Id = 2,FirstName = "Nicky", Lastname = "Lauren", DOB = new DateTime(2009, 01, 01), Gender = "Female"},
              new Student() { Id = 3, FirstName = "Amy", Lastname = "Park", DOB = new DateTime(2008, 01, 01), Gender = "Female" },
              new Student() { Id = 4, FirstName = "Aurelie", Lastname = "Adair", DOB = new DateTime(2007, 01, 01), Gender = "Female" }
  
  
          };
  
  
          //foreach (var x in students)
          //{
          //    Console.WriteLine("Id = {0}, FirstName = {1}, Lastname = {2}, DOB = {3}, Gender = {4}",x.Id,x.FirstName,x.Lastname,x.DOB,x.Gender);
          //}
  
  
          Console.WriteLine(" Please Choose one of the options:");
          Console.WriteLine("1&gt; Search by first name");
          Console.WriteLine("2&gt; Search by date of birth");
          switch ( Convert.ToInt32(Console.ReadLine()))
          {
              case 1:
                  Console.WriteLine("You choose:1");
                  Console.WriteLine("Type your first name:");
                  var a = Console.ReadLine();
  
                  var case1 = students.Where(x=&gt;x.FirstName==a);
  
                  if (case1.Count()!=0)
                  {
                      Console.WriteLine("Found! Here are the details:");
                      foreach (var x in case1)
                      {
                          Console.WriteLine("Name: {0}{1} D.O.B:{2} and Gender{3}", x.FirstName, x.Lastname, x.DOB, x.Gender);
                      }
  
  
                  }
                  else
                  {
                      Console.WriteLine(" Enter the correct information");
  
                  }
                  break;
  
              case 2:
                  Console.WriteLine("You choose:2");
                  Console.WriteLine("Enter your Date of Birth in format MM/DD/YYYY:");
  
                  var b = DateTime.Parse(Console.ReadLine());
                  //Console.WriteLine(b);
                  //Console.ReadLine();
  
                      var case2 = students.Where(x =&gt; x.DOB == b);
                  if (case2.Count() != 0)
                  {
                      Console.WriteLine("Found! Here are your details");
                      foreach (var x in case2)
                      {
                          Console.WriteLine("Name:{0} {1} DOB:{2} Gender:{3}", x.FirstName, x.Lastname, x.DOB, x.Gender);
                      }
                  }
                  else
                  {
                      Console.WriteLine(" Enter the correct information");
  
                  } 
                  break;
                  default:
                  Console.WriteLine("Please enter the valid option");
                  break;
  
          }
  
      }
  }
  </code></pre>
  
  <p>}</p>