VB.NET里的委托
一段C#代码想成VB.NET时,却有错误
C#代码ShowMsg.cs里只有一句
public delegate void ShowMsg(string strMsg);
public class Connection
{
string strPath;
ShowMsg showMsg;
ShowMsg removeConnection;
Thread threadMsg;
bool isWait = true;
...
public Connection(string strPath, ShowMsg showMsg, ShowMsg removeConnection)
{
...
this.strPath = strPath;
this.showMsg = showMsg;
this.removeConnection = removeConnection;
this.threadMsg = new Thread(WaitMsg);
this.threadMsg.IsBackground = true;
this.threadMsg.Start();
...
}
void WaitMsg()
{
while (isWait)
{
try
{
...
showMsg(strMsg);
}
catch (Exception ex)
{
...
removeConnection(strMsg);
}
}
}
...
Public Class ShowMsg
Public Delegate Sub ShowMsg(ByVal strMsg As String)
End Class