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

Ahmed Awadallah
Ahmed Awadallah
5,637 Points

The question s too vague, I can't move ahead.

It is asking for a public Func field, so I assume that this is some sort of an abstract method in a way. where should I write the implementation? is it in the declaration itself or should I define a Main function to declare it?

Program.cs
using System;

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

        /*public static Main(string[] args)
        {
            Square = delegate(int number)
            { 
                return number*number;
            };
        }*/
    }
}

1 Answer

Steven Parker
Steven Parker
231,248 Points

Your solution is correct (and no Main is needed). But the challenge is being overly picky about formatting. Try adding a space after the comma in the Func descriptor.

You might want to report this as a bug to Support.