我有一个类Parent
,它的属性Items
是List(of Child)
如果我使用此代码
Parallel.ForEach()(parent.Items,
Sub(item)
item.DoSomething()
End Sub)
我收到编译器警告No overload for method ForEach() accepts this count of arguments
如果我将代码更改为
Parallel.ForEach(of Child)(parent.Items,
Sub(item)
item.DoSomething()
End Sub)
有用。
但是,在 c# 中我可以只写
Parellel.ForEach(parent.Items, item =>
{
item.DoSomething();
});
为什么VB在这种情况下不推断?