Action(Of T) in Visual Basic in List(Of T).ForEach
Posted
by Jason
on Stack Overflow
See other posts from Stack Overflow
or by Jason
Published on 2009-05-21T09:12:13Z
Indexed on
2010/04/07
22:23 UTC
Read the original article
Hit count: 110
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.
© Stack Overflow or respective owner