title: Compare String and Object in C#
body: <p>See this code:</p>
  
  <pre><code>object x = "mehdi emrani";
  string y = "mehdi emrani";
  Console.WriteLine(y == x);
  </code></pre>
  
  <p>that returns <code>true</code>.</p>
  
  <p>But this code:</p>
  
  <pre><code>object x = "mehdi emrani";
  string y = "mehdi ";
  y += "emrani";
  Console.WriteLine(y == x);
  </code></pre>
  
  <p>returns <code>false</code>.</p>
  
  <p>So when I compare String and Object in first code I get <code>true</code>.<br>
  But when I compare them in  second code I get <code>false</code>.</p>
  
  <p>Both strings are same but why when I append to the string, my result returns <code>false</code>?</p>