title: Iterate through a DataTable to find elements in a List object?
body: <p>As I iterate through a <strong>DataTable</strong> object, I need to check each of its <strong>DataRow</strong> objects against the items in a generic string <strong>List</strong>.</p>
  
  <p>I found a <a href="http://www.csharpcourses.com/2008/05/how-to-find-object-in-generic-list.html" rel="noreferrer">blog post</a> using the List's Find method along with a delegate, but whereas that example has a separate class (Person), I'm attempting something like the following using an instance of the <strong>string</strong> object:</p>
  
  <pre><code>// My definition of the List object.
  List&lt;string&gt; lstAccountNumbers = new List&lt;string&gt;();
  ...
  
  // I populate the List via its Add method.
  ...
  
  foreach (DataRow drCurrentRow in dtMyDataTable.Rows) 
  {
      if (lstAccounts.Find(delegate(string sAccountNumber) { return sAccountNumber == drCurrentRow["AccountNumber"]; })
      {
          Found_DoSomething();
      }
      else
      {
          NotFound_DoSomethingElse();
      }
  }
  </code></pre>
  
  <p>However, with this syntax I'm receiving "Cannot implicitly convert type 'string' to 'bool'" for the <strong>if</strong> block. </p>
  
  <p>Could someone please clarify what I'm doing wrong and how best to accomplish what I'm trying to do?</p>