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

Eric Hiltz
Eric Hiltz
5,666 Points

What is this question asking for?

The question in Querying with LINQ is the following: In the Program class, declare a public Func field named Square that takes an int and returns an int. Use an anonymous method to assign a delegate that takes an int parameter named number and returns the result of number * number.

My code is this: public Func<int, int> Square = delegate (int number) { return number * number; };

What am I missing here? This runs fine, but the answer isn't accepted.

2 Answers

Steven Parker
Steven Parker
231,268 Points

Odd, I copied that line and pasted it into the blank line on the challenge (line 7), and it passed task 1.

Try again?

Eric Hiltz
Eric Hiltz
5,666 Points

Yep, I just had to refresh my browser and try again.