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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:45:39+00:00 2026-05-11T17:45:39+00:00

I have searched high and low for documentation on how to use this feature.

  • 0

I have searched high and low for documentation on how to use this feature. While the loop I could write would be simple and take no time, I really would like to learn how to use this.

Basically I have a class, say, Widget, with a Save() sub that returns nothing. So:

Dim w as New Widget()
w.Save()

basically saves the widget. Now let’s say I have a generic collection List(Of Widget) name widgetList(Of Widget) and I want to run a Save() on each item in that list. It says I can do a

widgetList.ForEach([enter Action(Of T) here])

….but how in the F does this work??? There is no documentation anywhere on the intrablags. Help would be much much appreciated.

  • 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-11T17:45:39+00:00Added an answer on May 11, 2026 at 5:45 pm

    If you’re using VB9 (VS2008) I don’t think you’ll be able to use an anonymous function easily – as far as I’m aware, anonymous functions in VB9 have to be real functions (i.e. they have to return a value) whereas Action<T> doesn’t return anything. C# 2’s anonymous methods and C# 3’s lambda expressions are more general, which is why you’ll see loads of examples using List<T>.ForEach from C# and very few using VB 🙁

    You could potentially write a MakeAction wrapper which takes a Function<T,TResult> and returns an Action<T>, but I suspect other restrictions on VB9 anonymous functions would make this impractical.

    The good news is that VB10 has much more anonymous function support. (C#4 and VB10 are gaining each other’s features – I believe MS is trying to go for language parity from now on, to a larger extent than before.)

    Until then, to use List<T>.ForEach you’ll need to write an appropriate Sub and use AddressOf to create a delegate from it. Here’s a small example:

    Imports System
    Imports System.Collections.Generic
    
    Public Class Test
    
        Shared Sub Main()
            Dim names as New List(Of String)
            names.Add("Jon")
            names.Add("Holly")
            names.ForEach(AddressOf PrintMe)
    
        End Sub
    
        Shared Sub PrintMe(ByVal text as String)
            Console.WriteLine(text)
        End Sub
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

this is my first time posting here, I have a question which I have
Currently, I have a String object that contains XML elements: String carsInGarage = garage.getCars();
I have searched high and low and cannot find a Samsung Omnia SDK. I
When I try to load a solution in Visual Studio 2008, it immediately closes.

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.