You need to change the line as follows:
Thread clsUDPThread = new Thread(new ThreadStart(delegate() { clsUDP.UDPListen(64000, typeof(ServerClass)); }));
, - () ( , / ). , .
EDIT:
- .
public interface IUDPListener
{
void Notify(string status);
}
UDP
public void UDPListen(int UDPPort, IUDPListener listner)
{
...
listener.Notify("bla bla");
...
}
public class ServerClass : IUDPListener
{
...
public void Notify(string status)
{
...
}
public void StartThread()
{
UDPClass clsUDP = new UDPClass();
Thread clsUDPThread = new Thread(new ThreadStart(delegate() { clsUDP.UDPListen(64000, this); }));
clsUDPThread.Start();
}
}
, . , / , .
UDP
public void UDPListen(int UDPPort, Action<string> callback)
{
...
callback("bla bla");
...
}
public class ServerClass
{
...
private void UdpCallback(string message)
{
...
}
UDPClass clsUDP = new UDPClass();
var clsUDPThread = new Thread(new ThreadStart(delegate() {clsUDP.UDPListen(64000, UdpCallback); }));
clsUDPThread.Start();