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 Functional Programming in C# LINQ Method Syntax

I think I am very close - I have created the OrderByDescending LINQ query

Is there a syntax error here? it is not passing

NumberAnalysis.cs
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 IEnumerable<int> NumbersGreaterThanFive()
        {

            return _numbers.Where(n => n > 5);

        }

        public IEnumerable<int> ReverseNumbers()

            return _numbers.OrderByDescending(n => n < 5);
               }
}

1 Answer

Steven Parker
Steven Parker
229,785 Points

It looks like you are missing an open brace ("{").

It would come before the body of the new method. The matching close brace is already at the end.

Also, check the lambda in your LINQ. The challenge didn't ask for the numbers to be limited this time, just re-ordered.