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 trial

C# Querying With LINQ Now You're Querying Using Query Syntax

Yiu Ming Lai
Yiu Ming Lai
5,861 Points

Need Help

I am sitting this. what dose it mean.

NumberAnalysis.cs(8,22): error CS0542: `Treehouse.CodeChallenges.NumberAnalysis.NumberAnalysis': member names cannot be the same as their enclosing type NumberAnalysis.cs(6,18): (Location of the symbol related to previous error) Compilation failed: 1 error(s), 0 warnings

NumberAnalysis.cs
using System.Collections.Generic;
using System.Linq;

namespace Treehouse.CodeChallenges
{
    public class NumberAnalysis
    {
        public class NumberAnalysis
        {
            private List<int> _numbers;
            public NumberAnalysis()
            {
                _numbers = new List<int> { 2, 4, 6, 8, 10 };
            }

            public IEnumerable<int> NumbersGreaterThanFive()
            {
                IEnumerable<int> numbersGreaterThanFive = from n in _numbers where n > 5 select n;
                return numbersGreaterThanFive;
            }
        }
    }
}

1 Answer

Steven Parker
Steven Parker
231,275 Points

:point_right: You've put another class definition inside the original class definition.

Copy/paste error, perhaps? Just remove the extra class definition and you should be good.