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

  • Home
  • SEARCH
  • 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 218643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:46:14+00:00 2026-05-11T18:46:14+00:00

Firstly I can’t get my head around the functional / Lambda aspects of .NET

  • 0

Firstly I can’t get my head around the functional / Lambda aspects of .NET 3.5. I use these features everyday in LINQ, but my problem is understanding the implementation, and what they really mean (Lambda? System.Func? etc etc)

With this in mind, how would the following be achieved:

As an example, I’d like to have an Extension method for List(Of T) which sets the properties of all the objects in the List to a certain value, and returns the updated List(Of T). It would be called like this:

VB:

 Dim someList As List(Of TextBox) =  (New List(Of TextBox)).UpdateExtension(Function(txtb) txtb.Text = "something")

C#:

List<TextBox> someList = (new List<TextBox>()).UpdateExtension(txtb => txtb.Text = "something");

What would the Extension method look like, in both VB and C#?

i.e:

 <Extension()> _
 Public Function UpdateExtension(Of T)(ByVal source As List(Of T), ByVal predicate As ??) As List(Of T)
        '??
 End Function

cheers!

EDIT

As many have pointed out, the above can be achieved, more or less, with .ForEach(). But my interest is in understading how something like .ForEach() is implemented, i.e. I’m interested in the implementation of the solution for the above problem.

  • 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-11T18:46:15+00:00Added an answer on May 11, 2026 at 6:46 pm

    Really you’re miking and matching extension methods here. It’s almost a combination of Select and ForEach. It appears you want a method that will allow you to both modify elements of a list and return the original enumeration. The following should do the trick for you.

    VB.Net

    <Extension()> _
    Public Function UpdateExtension(Of T)(ByVal source As IEnumerable(Of T), ByVal del As Action(Of T)) As IEnumerable(Of T)
      For Each cur in source
        del(cur)
      Next
      Return source
    End Function
    

    C#

    public static IEnumerable<T> UpdateExtension<T>(this IEnumerable<T> source, Action<T> del) {
      foreach ( var cur in source ) {
        del(cur);
      }
      return source;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 172k
  • Answers 172k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I would use exceptions only when the error is serious… May 12, 2026 at 2:27 pm
  • Editorial Team
    Editorial Team added an answer try this, I'm not sure about the name of the… May 12, 2026 at 2:27 pm
  • Editorial Team
    Editorial Team added an answer You may find that using raw JavaScript rather than a… May 12, 2026 at 2:27 pm

Related Questions

Firstly I can't get my head around the functional / Lambda aspects of .NET
Firstly, I was wondering if there was some kind of built in function that
Firstly I know that there are many question and solutions to correct thread marshalling
Firstly: I am totally a newbie for this kind of work. I have a
i posted the other day with practice questions i was getting stuck with and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.