title: How can I do a case insensitive string comparison?
body: <p>How can I make the line below case insensitive?</p>
  
  <pre><code>drUser["Enrolled"] = 
        (enrolledUsers.FindIndex(x =&gt; x.Username == (string)drUser["Username"]) != -1);
  </code></pre>
  
  <p>I was given some advice earlier today that suggested I use: </p>
  
  <pre><code>x.Username.Equals((string)drUser["Username"], StringComparison.OrdinalIgnoreCase)));
  </code></pre>
  
  <p>the trouble is I can't get this to work, I've tried the line below, this compiles but returns the wrong results, it returns enrolled users as unenrolled and unenrolled users as enrolled.</p>
  
  <pre><code>drUser["Enrolled"] = 
        (enrolledUsers.FindIndex(x =&gt; x.Username.Equals((string)drUser["Username"], 
                                   StringComparison.OrdinalIgnoreCase)));
  </code></pre>
  
  <p>Can anyone point out the problem?</p>