title: Cannot convert system.consolekeyinfo to string
body: <p>What I'am trying to achieve here is that when you press "1" it will check it against "code_1" and then if it matches it will say "key1 correct" and then check the other codes. But the compiler says </p>
  
  <blockquote>
    <p>Cannot convert system.consolekeyinfo to string</p>
  </blockquote>
  
  <p>so I'm wondering how I fix this. Here is the code that I use :</p>
  
  <pre><code>    static void Main(string[] args)
      {
          string first_time = null;
          string paktc = "Press any key to continue . . .\r\n";
          string code_1 = "1";
          string code_2 = "2";
          string code_3 = "3";
          string code_4 = "4";
          if (first_time == null)
          {
              Console.WriteLine("\r\nYour code is 1234\r\n");
              Console.WriteLine(paktc);
              Console.ReadKey();
              Console.WriteLine("Insert Code Now\r\n");
  
              ConsoleKeyInfo key1 = Console.ReadKey();
              if (code_1 = key1)
              {
                  ConsoleKeyInfo key2 = Console.ReadKey();
                  if (code_2 = key2)
                  {
                      ConsoleKeyInfo key3 = Console.ReadKey();
                      if (code_3 = key3)
                      {
                          Console.WriteLine("Key3 Correct\r\n");
                          ConsoleKeyInfo key4 = Console.ReadKey();
                          if (code_4 = key4)
                          {
                              Console.WriteLine("Key4 Correct\r\n");
                              Console.ReadKey();
                              Console.WriteLine(paktc);
                          }
                          else
                          {
  
                          }
                      }
                      else
                      {
  
                      }
                  }
                  else
                  {
  
                  }
              }
              else
              {
  
              }
          }
      }
  }
  </code></pre>