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# Lambda Expressions

Giulio Vannini
Giulio Vannini
21,922 Points

This challenge is making fun of me..

The syntax here is correct. However the challenge is not passing saying that "i must use the same variable names in the parameters". Any idea of what it may be wrong?

Program.cs
using System;

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

        public Action<int, Func<int, int>> DisplayResult = int result, Func<int, int> function =>
        {
            Console.WriteLine(function(result));
        };

        static void Main(string[] args)
        {

        }
    }
}

2 Answers

Giulio Vannini
Giulio Vannini
21,922 Points

Solved with:

using System;
namespace Treehouse.CodeChallenges
{
    public class Program
    {     
        public Func<int, int> Square =  (number) =>
        {
            return number * number;
        };
        public Action<int, Func<int, int>> DisplayResult = (result, function) =>
        {
            Console.WriteLine(function(result));
        };
        static void Main(string[] args)
        {
        }
    }
}
Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

I strongly recommend that you don't show the answer