Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1078837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:46:57+00:00 2026-05-16T21:46:57+00:00

I haven’t really been able to get a firm grasp on creating and using

  • 0

I haven’t really been able to get a firm grasp on creating and using lambda expressions. I know how to use them in linq statements, but I really don’t understand what’s going on behind the scenes. I also havent been able to find a complete tutorial on when to use them, how to define them, etc.

Second part…

They say that Javascript is a LAMBDA language, I know javascript fairly well, just wondering what types of concepts that apply to javascript lambdas and c# lambdas.

thrid part…

what is the difference between a functional language and an lambda language?

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:46:57+00:00Added an answer on May 16, 2026 at 9:46 pm

    Let me give you the scoop on what’s going on behind the scenes. It is more straightforward than you think.

    Suppose you have:

    delegate int D(int x);
    ...
    class C
    {
        void M(int y)
        {
            int z = 123;
            D d = x=>x+y+z;
            Console.WriteLine(d(10));
            z = 345;
            y = 789;
            Console.WriteLine(d(10));
       }
    }
    

    All the compiler does is pretends that you wrote:

    delegate int D(int x);
    ...
    class C
    {  
        private class Locals
        {
            public int y;
            public int z;
            public int A(int x)
            {
                return x + this.y + this.z;
            }
        }
        void M(int y)
        {
            // Initialize the closure class:
    
            Locals locals = new Locals();
            locals.y = y;
    
            // Transform the body so that all usages of y, z and the lambda
            // refer to the closure class:
    
            locals.z = 123;
            D d = locals.A;
            Console.WriteLine(d(10)); // Calls locals.A(10)
            locals.z = 345;
            locals.y = 789;
            Console.WriteLine(d(10)); // Calls locals.A(10)
    
        }
    }
    

    That’s all there is to it. A lambda is just a compact syntax for writing “hoist all the outer local variables used by the lambda into a class, make a method on the class with a given body, and make me a delegate out of that method”.

    Function closures in JScript work essentially the same way. JScript of course is not a class-based language so the details are slightly different, but the idea is the same. In C#, the newly created delegate object keeps track of the locals class, which has the variable state. In JScript, the newly created function object has a reference to the activation frame of the function which created the closure, which is basically the same information.

    The way lambdas are converted to expression trees is rather different, but this should at least get you started in understanding the idea of lambdas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't been able to find a very good way of getting 10 random
I haven't been able to find authorative explanations, microformats or guidelines for the following,
I haven't been able to find what these Xcode icons mean. Some you can
I haven't been able to solve this prolog exercise. I was hoping someone here
I haven't used the implements keyword before, and I've been trying to use it
I haven't been able to find a straight answer on this. Can anyone tell
I have looked around the internet but haven't been able to find a working
I haven't been able to see anything in the documentation which speaks to my
I haven't completely understood, how to use sigprocmask() . Particularly, how the set and
Haven't seen this feature anywhere else. I know that the 32nd bit is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.