【发布时间】:2017-08-30 05:16:32
【问题描述】:
我目前有一个用 C# 编写的示例应用程序,我想在我的 VB.NET 项目中使用其中的代码。现在,我试图复制的函数如下所示:
private void Start(CardInfo networkCard, IEnumerable<int> universes)
{
socket = new StreamingAcnSocket(Guid.NewGuid(), "Streaming ACN Snoop");
socket.NewPacket += new EventHandler<NewPacketEventArgs<Acn.Packets.sAcn.StreamingAcnDmxPacket>>(socket_NewPacket); //This is the line I'm having trouble with
socket.Open(networkCard.IpAddress);
foreach (int universe in universes)
socket.JoinDmxUniverse(universe);
dmxOutput = new DmxStreamer(socket);
dmxOutput.AddUniverse(sendData.Universe);
acnPortExplorer = new RdmNetEndPointExplorer();
acnPortExplorer.LocalAdapter = networkCard.IpAddress;
acnPortExplorer.NewEndpointFound += acnPortExplorer_NewEndpointFound;
acnPortExplorer.Start();
}
这是我目前的 VB 代码:
Private Sub Start(networkCard As CardInfo, universes As IEnumerable(Of Integer))
socket = New StreamingAcnSocket(Guid.NewGuid(), "Streaming ACN Snoop")
''yet to convert this line
socket.Open(networkCard.IpAddress)
For Each universe As Integer In universes
socket.JoinDmxUniverse(universe)
Next
dmxOutput = New DmxStreamer(socket)
dmxOutput.AddUniverse(sendData.Universe)
acnPortExplorer = New RdmNetEndPointExplorer()
acnPortExplorer.LocalAdapter = networkCard.IpAddress
acnPortExplorer.NewEndpointFound += acnPortExplorer_NewEndpointFound
acnPortExplorer.Start()
End Sub
我正在尝试将此以及其他功能转换为 VB。我已经设法在在线代码转换器的帮助下转换了几乎所有内容。但是,我仍然无法弄清楚如何将第 4 行转换为 VB。
如果重要的话,这是来自 ACN on codeplex (https://acn.codeplex.com/) 的 StreamingACN 示例项目。
如果能得到任何帮助,我将不胜感激。谢谢!
【问题讨论】:
-
第 4 行到底是哪一行?请在代码中添加注释
-
刚刚回答了与此类似的问题:stackoverflow.com/questions/45946790/… -- 另见:stackoverflow.com/a/34278039
-
你的VB代码在哪里