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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:57:35+00:00 2026-05-10T15:57:35+00:00

In a question answer I find the following coding tip:- 2) simple lambdas with

  • 0

In a question answer I find the following coding tip:-

2) simple lambdas with one parameter:

x => x.ToString() //simplify so many calls 

As someone who has not yet used 3.0 I don’t really understand this tip but it looks interesting so I would appreciate an expantion on how this simplifies calls with a few examples.

I’ve researched lambdas so I think I know what they do, however I may not fully understand so a little unpacking might also be in order.

  • 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. 2026-05-10T15:57:36+00:00Added an answer on May 10, 2026 at 3:57 pm

    When you need to create an instance of a delegate which has a single parameter, lambda expressions allow you to create that delegate ‘inline’ in a very concise manner. For instance, here’s code to find a particular person in a list, by their name:

    List<Person> list = new List<Person>(); // [..] Populate list here Person jon = list.Find(p => p.Name == 'Jon'); 

    In C# 2.0 you could use an anonymous method which was a little bit more longwinded, but not too bad:

    List<Person> list = new List<Person>(); // [..] Populate list here Person jon = list.Find(delegate(Person p) { return p.Name == 'Jon'; }); 

    In C# 1.0 you’d have to create a whole extra method. In addition, if you wanted to parameterise it, you’d have to create a different type, whereas anonymous methods and lambda expressions capture their executing environment (local variables etc) so they act like closures:

    public Person FindByName(List<Person> list, String name) {     return list.Find(p => p.Name == name); // The 'name' variable is captured } 

    There’s more about this in my article about closures.

    While passing delegates into methods isn’t terribly common in C# 2.0 and .NET 2.0, it’s a large part of the basis of LINQ – so you tend to use it a lot in C# 3.0 with .NET 3.5.

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

Sidebar

Related Questions

I can not really find a satisfying answer to the following question: What would
Simple question but cannot find answer anywhere. When using a MS Chart Control of
This might be a simple question to answer, but I couldn't find the answer.
I can't find an answer to the following question: object o = 10; //
It seems like a simple beginners question, but I'm unable to find an answer
Sorry for question but I can't find answer anywhere on internet. I couldn't find
I have stupid question, on which can't find answer. I tried to install Selenium
I'm sorry if this is a foolish question, but I couldn't find answer with
It this possible? How? (Maybe silly question, but I couldn't find answer :( )
Can't find the answer to my question in MSND: Does Timer class guarantees that

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.