title: Error on if statement - cannot implicitly convert type to 'bool'
body: <p>I am having an issue converting type. I was trying code like this (minimal, detailed code later):</p>
  
  <pre><code>string cityType = "City1";
  int listingsToSearch = 42;
  if (cityType = "City1") // &lt;-- error on this line
  {
      listingsToSearch = 1;
  }
  </code></pre>
  
  <p>But "if" statement to convert the cities but I keep getting:</p>
  
  <blockquote>
    <p>cannot implicitly convert type 'string' to 'bool'</p>
  </blockquote>
  
  <hr>
  
  <p>What I'm trying to achieve: I have a search engine that has a textbox for the search text and two radio buttons for the search location ( IE City1 or City2 )</p>
  
  <p>When I receive the search text and radio buttons they are in the form of a string</p>
  
  <pre><code>string thesearchtext, thecitytype;
  thesearchtext = HttpContext.Current.Request.QueryString["s"].ToString();
  thecitytype = HttpContext.Current.Request.QueryString["bt"].ToString();
  </code></pre>
  
  <p>When I receive the cities radiobutton they will be in the format of "city1" or "city2".</p>
  
  <p>What i need to do is convert the city radiobuttons into an int so that I can use them in my search dataset. I need to convert <code>"city"</code> to integer <code>1</code> and <code>"city2"</code> to integer <code>2</code>.</p>
  
  <p>I understand this is probably a simple type conversion however I just cannot figure it out. So far code with <code>if</code> gives me error above:</p>
  
  <pre><code>int listingsToSearch;
  if (thecitytype = "City1")
  {
      listingsToSearch = Convert.ToInt32(1);
  }
  else
  {
      listingsToSearch = Convert.ToInt32(2);
  }
  </code></pre>