Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCaitlin Baker
15,779 PointsUsing Query Syntax
When I try to run the following code, I receive an error "NumberAnalysis.cs(14,16): error CS0246: The type or namespace name `IEnumberable' could not be found. Are you missing an assembly reference?" - I thought including the System.Linq using directive was what it wanted, but that passed in the first step. I could use a little help understanding what I've done wrong.
using System.Collections.Generic;
using System.Linq;
namespace Treehouse.CodeChallenges
{
public class NumberAnalysis
{
private List<int> _numbers;
public NumberAnalysis()
{
_numbers = new List<int> { 2, 4, 6, 8, 10 };
}
public IEnumberable<int> NumbersGreaterThanFive = from n in _numbers
where n > 5
select n;
}
}
1 Answer
Steven Parker
231,248 PointsI see two issues here:
- The term "IEnumerable" does not have a letter "b" in it
- you attempted to create a field instead of a method
Your LINQ query is good, but you need some parentheses, brackets and a return preceding the query.