title: Using Linq to object, how can I get one field's value based on another in the same list
body: <p>I have a class that is defined as following:</p>
  
  <pre><code>public class MyClass
  {
      public int ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>Then I have a logic where I build a list of that class:</p>
  
  <pre><code>MyList = new List&lt;MyClass&gt;;
  foreach(MyClassData myClass in Service.MyClassList)
  {
      MyList.Add(new MyClass{ID = myClass.ID, Name = myClass.Name});
  }
  </code></pre>
  
  <p>Now, I need to get an 'ID' based on the 'Name'.</p>
  
  <p>I'm trying the following:</p>
  
  <pre><code>int id01 = MyList.Where(x =&gt; x.FileName.Equals("File01")).Single(x =&gt; x.FileID)
  </code></pre>
  
  <p>Doing that I'm getting an error message:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'int' to 'bool'</p>
  </blockquote>
  
  <p>How would I do that using LINQ?</p>