我正在尝试将元组从c#转换为vb.net.这是元组的声明 -
private List>> items = new List >>();
我将项目添加到Item3(动作),就像这样 -
foreach(var iforeach(var i in items) { i.Item3(t, string.Empty); }
在vb.net中,我将我的元组定义如下 -
Private list As New List(Of Tuple(Of String, String, Action(Of T, String)))
并试图像这样添加一个动作到Item3 -
Dim mytype = Activator.CreateInstance(Of T) For Each item As Tuple(Of String, String, Action(Of T, String)) In list item.Item3(mytype, String.Empty) Next
我已经尝试了不同方式的各种迭代来向Item3添加Action,但似乎没有用.对于上面的示例,我在VS中获得以下消息 - 参考的参数数量不正确....
任何人都可以了解如何将其转换为vb.net?谢谢.
您不需要使用单独的变量 - 只需使用显式空括号对来防止编译器混淆(将'Item3'误解为参数化属性,如Darryl所说):
For Each i In items i.Item3()(mytype, String.Empty) Next i