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

Huey Shepard
PLUS
Huey Shepard
Courses Plus Student 1,430 Points

I'm having problems with Linq question 2. What am I doing wrong. My answer compiles in Visual Studio.

Challenge Task 2 of 3

Create a public Action field named DisplayResult that takes an int parameter and a Func<int, int> parameter. Initialize it with an anonymous method delegate that takes an int result parameter, and a Func<int, int> named operation.

-----------------------------------------Code from Program.css---------------------------------- using System;

namespace Treehouse.CodeChallenges { public class Program {

  public Action<int, Func<int, int>> DisplayResult  = delegate (int result, Func<int, int> operation){};  
}

}

1 Answer

Steven Parker
Steven Parker
231,275 Points

It looks like the task 1 code is missing.

In task 1, you created a field named Square, but I don't see it in the code above. In multi-task challenges, each new task must be added to the code created for the previous task(s).

Otherwise, the code you're adding for task 2 looks good.