title: LINQ - type arguments cannot be inferred from the usage in a select
body: <p>I have the following where objectiveData is:  <code>IEnumerable&lt;Objective&gt;</code></p>
  
  <pre><code>    public IList&lt;Objective&gt; createObjectives()
      {
          var objectiveData = GetContent.GetType5(); 
          var objectives = objectiveData.Select(o =&gt; {
              var result = new Objective {
                              Name = o.Name,
                              Text = o.Text
              };
              if (o.Name != null &amp;&amp; o.Name.EndsWith("01"))
              {
                  result.ObjectiveDetails.Add
                  (
                      new ObjectiveDetail
                      {
                          Text = o.Text
                      }
                  );
              }
          });
          return objectives.ToList();
      }
  </code></pre>
  
  <p>I am getting an error on the line with the "select" saying:</p>
  
  <pre><code>The type arguments for method 'System.Linq.Enumerable.Select&lt;TSource,TResult&gt;
  (System.Collections.Generic.IEnumerable&lt;TSource&gt;, System.Func&lt;TSource,int,TResult&gt;)' 
  cannot be inferred from the usage. Try specifying the type arguments explicitly.
  </code></pre>
  
  <p>Here's my Objective class:</p>
  
  <pre><code>public partial class Objective : AuditableTable
  {
      public Objective()
      {
          this.ObjectiveDetails = new List&lt;ObjectiveDetail&gt;();
      }
      public int ObjectiveId { get; set; }
      public string Name { get; set; }
      public string Text { get; set; }
      public virtual ICollection&lt;ObjectiveDetail&gt; ObjectiveDetails { get; set; }
  }
  </code></pre>