开发者

Every nth Item In A Collection in VB.Net

开发者 https://www.devze.com 2023-03-05 13:18 出处:网络
Nearly identical to How can I get every nth item from a L开发者_运维百科ist<T>? But I\'m having trouble turning

Nearly identical to How can I get every nth item from a L开发者_运维百科ist<T>?

But I'm having trouble turning

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

Into VB.Net code.


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.


Literally, that would be:

dim list as List(of T) = originalList.Where(Function(t, i) (i mod 5) = 0).ToList()
0

精彩评论

暂无评论...
验证码 换一张
取 消