While writing my last 2 blogposts I noticed that the Parallel.For was kinda better in C# than the VB.Net version.
This is what I had in VB.Net.
Edit
vbnet
Parallel.For(0, 5, Sub(b)
CheckOnline(b)
End Sub)
Which would be this in C#
csharp
Parallel.For(0, 5, b => {CheckOnline(b)});
or the slightly shorter versions.
vbnet
Parallel.For(0, 5, Sub(b) CheckOnline(b))
Which would be this in C#
csharp
Parallel.For(0, 5, b => CheckOnline(b));
End Edit.
or the even shorter version in C# first.
csharp
Parallel.For(0, 5, CheckOnline);
Apparently it is able to infer the parameter to send in C# (see no more b just the methodname. Resharper told me that. So I searched for a way to do this in VB.Net and here it is.
vbnet
Parallel.For(0, 5, AddressOf CheckOnline)
A little more verbose but just a little.
I learn a little every day.