title: Equals() vs Static string.Equals()
body: <p>Reading about string comparison in c# i found many ways to compare 2 strings to see if they are equal.</p>
  
  <p>I was used to <code>==</code> coming from c++ but i learned that if you compare an object with a string then <code>==</code> defaults to reference value (or something like that).</p>
  
  <p>Then for the <code>Equals()</code> method lets say i have 2 strings.</p>
  
  <pre><code>string s1 = null;
  string s2 = "Hello";
  </code></pre>
  
  <p>if i do <code>s1.Equals(s2);</code></p>
  
  <p>I get an <strong>null-reference exception</strong> cause the first string is null</p>
  
  <p>But if i do </p>
  
  <p><code>string.equals(s1,s2);</code></p>
  
  <p>It will simply return <code>false</code> if one of the values is <code>null</code> and if both the values are <code>null</code> it will return <code>true</code> since both strings would be equal in that they are both <code>null</code>.</p>
  
  <p>So is there any reason not to always use the <code>string.equals()</code> method.
  Also another thing is that if i type the <code>string.equals()</code> with a capital S in the string like this <strong>S</strong><code>tring.equals()</code> then it wll still run the same as if i had it lower case but the IDE (visual studio 2015) will tell me that it can be simplified and when i simplify it it turn it to a lower case s. Why is that?</p>