C# Querying With LINQ Functional Programming in C# Actions and Funcs

Walker Firmin
Walker Firmin
2,487 Points

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
168,104 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.