码:
public Thread ThreadReceive; ThreadReceive = New System.Threading.Thread(AddressOf ReceiveMessages) ThreadReceive.Start() Public Sub ReceiveMessages() Try Dim receiveBytes As [Byte]() = receivingUdpClient.Receive(RemoteIpEndPoint) txtIP.Text = RemoteIpEndPoint.Address.ToString Dim BitDet As BitArray BitDet = New BitArray(receiveBytes) Catch e As Exception Console.WriteLine(e.Message) End Try End Sub
任何人都可以建议我如何转换这一行:
ThreadReceive = New System.Threading.Thread(AddressOf ReceiveMessages)
vb到C#
谢谢,
岜沙.
解决方法
假设没有名称更改,这应该工作:
ThreadReceive = new System.Threading.Thread(receiveMessage);
AddressOf创建ReceiveMessages的委托,这在C#中暗示.