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# Actions and Funcs

This works but it is not being accepted:

public Func<int,int> Square = delegate(int number) {return number * number; };

Program.cs
using System;

namespace Treehouse.CodeChallenges
{
    public Func<int,int> Square = delegate(int number)
        {
            return number * number; 
        };
}

1 Answer

Steven Parker
Steven Parker
231,275 Points

The instructions say "In the Program class, declare a public Func field named Square ...".

It looks like the provided boilerplate for the Program class got deleted accidentally. Your new code needs to go inside the provided Program class.

Also, the validator has a quirk that causes it to reject a "Func" spec unless there is a space after the comma. If you want, you can submit a bug report about it to the Support folks.