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 7625349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:10:50+00:00 2026-05-31T05:10:50+00:00

Are lambda expressions (and to a degree, anonymous functions) closures? My understanding of closures

  • 0

Are lambda expressions (and to a degree, anonymous functions) closures?

My understanding of closures are that they are functions that are treated as objects, which seems to be an accurate representation of what anonymous functions and Lambda expressions do.

And is it correct to call them closures? I understand that closures came about (or became popular) due to the lisp dialect, but is it also a general programming term?

Thanks for any clarification that you can provide!

  • 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-31T05:10:51+00:00Added an answer on May 31, 2026 at 5:10 am

    A lambda may be implemented using a closure, but it is not itself necessarily a closure.

    A closure is “a function together with a referencing environment for the non-local variables of that function.”.

    When you make a lambda expression that uses variables defined outside of the method, then the lambda must be implemented using a closure. For example:

    int i = 42;
    
    Action lambda = () => { Console.WriteLine(i); }; 
    

    In this case, the compiler generated method must have access to the variable (i) defined in a completely different scope. In order for this to work, the method it generates is a “function together with the referencing environment” – basically, it’s creating a “closure” to retrieve access to the variable.

    However, this lambda:

    Action lambda2 = () => { Console.WriteLine("Foo"); }
    

    does not rely on any “referencing environment”, since it’s a fully contained method. In this case, the compiler generates a normal static method, and there is no closure involved at all.

    In both cases, the lambda is creating a delegate (“function object”), but it’s only creating a closure in the first case, as the lambda doesn’t necessarily need to “capture” the referencing environment in all cases.

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

Sidebar

Related Questions

In C#, are lambda expressions objects? If so, what sort of object are they?
After discovering lambda expressions, and their use as anonymous functions, I've found myself writing
I know that lambda expressions within loops can cause problems if they use local
I'm developing a API that uses lambda expressions to specify properties. I'm using this
Wondering if there is any way to get the lambda expressions that result from
When using lambda expressions or anonymous methods in C#, we have to be wary
Can somebody explain me lambda expressions & what they can be used for. I
How do the Lambda Expressions / Closures in C++0x complicate the memory management in
I'm still having problems to write lambda expressions that should create some object and
Is there an application or utility that will convert LINQ to Lambda Expressions? (or

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.