title: How do you convert IEnumerable<int> to an Int32
body: <p>I've got a linq query that will return 1 result which will be an integer. I want to assign this to an Int32 variable to be used later, however I get an error that reads, "int does not contain a definition for RatingNumber and no extension method RatingNumber acepting a first argument of type int could be found (are you missing a using directive or an assembly reference?)</p>
  
  <p>this is the code that calls the query</p>
  
  <pre><code>IEnumerable&lt;int&gt; newRatingNumber = getNewRecipeNumbers.newRatingNum();
  
          foreach (var a in newRatingNumber)
          {
              ratingNumber = a.RatingNum;
          }
  </code></pre>
  
  <p>and this is the query:</p>
  
  <pre><code> public IEnumerable&lt;int&gt; newRatingNum()
      {
          ratingTableAdapter.Fill(recipeDataSet.Rating);
          var newRatingNum = (from a in recipeDataSet.Rating
                              where a.UserRating == 0 &amp;&amp;
                              a.FamilyRating == 0 &amp;&amp;
                              a.HealthRating == 0 &amp;&amp;
                              a.EaseOfCooking == 0 &amp;&amp;
                              a.CookingTime == 0
                              select a.RatingNum);
          return newRatingNum;
      }
  </code></pre>
  
  <p>I tried using Convert.ToInt32 to cast the result to an int, this got rid of compiling errors, this however created an InvalidCastException. Anyone have any ideas?</p>
  
  <p>Thanks for the help</p>
  
  <p>Craig</p>