VB.Net to C# conversion of port checker
I found some VB.Net port checking code and need to convert it to C#. Using an online tool, it converted this:
Dim newThread As New Thread(AddressOf ConnectCheck.CheckOpen) 'new thread
to this:
Thread newThread = new Thread(new System.EventHandler(ConnectCheck.CheckOpen));
Which causes this error:
cannot convert from 'System.EventHandler' to 'System.Threading.ParameterizedThreadStart'
And this:
'all threads up and running Dim foo As Long = 0L Do 'wait for all the threads to stop Thread.Sleep(1000) Interlocked.CompareExchange(foo, 1, countRunning) Loop While foo = 0L
to this:
// all threads up and running long foo; for ( ; // TODO: Warning!!!! NULL EXPRESSION DETECTED... ; ) { Thread.Sleep(1000); Interlocked.CompareExchange(foo, 1, countRunning); }
This causes this error:
The best overloaded method match for 'System.Threading.Interlocked.CompareExchange(ref long, long, long)' has some invalid arguments
Can anyone help out?
0 comments:
Post a Comment