1

Nearly identical to How can I get every nth item from a List<T>?

But I'm having trouble turning

 List<T> list = originalList.Where((t,i) => (i % 5) == 0).ToList();

Into VB.Net code.

Community
  • 1
  • 1
Rob P.
  • 14,921
  • 14
  • 73
  • 109
  • 2
    You may find this helpful in the future for problems like this: http://www.developerfusion.com/tools/convert/csharp-to-vb/. This tool can convert almost any C# code to the equivalent VB.Net code. It works perfectly on this code sample. – mellamokb May 13 '11 at 16:50

2 Answers2

4

It becomes

Dim list as List(Of T) = originalList.Where(Function(t,i) (i Mod 5) = 0).ToList()

Lambdas in Visual Basic use the Function and Sub keywords.

R. Martinho Fernandes
  • 228,013
  • 71
  • 433
  • 510
1

Literally, that would be:

dim list as List(of T) = originalList.Where(Function(t, i) (i mod 5) = 0).ToList()
Jeff Paulsen
  • 2,132
  • 1
  • 12
  • 10