VB.NET:新线程的匿名函数

时间:2011-04-29 21:05:16

标签: vb.net multithreading

我有这段代码:

Public Sub Submit(
    ByVal reasonId As Integer, 
    ByVal email As String, 
    ByVal message As String
)
    '[Argument validation code here]
    EmailController.sendMail(reasonId, email, message)
End Sub

我想在新线程中关闭它,以便在创建并启动线程后Submit()返回。

在C#中,我可以这样做:

new Thread(() => {
        EmailController.sendMail(reasonId, email, message)
}).Start();

我如何在VB.NET中执行此操作?

1 个答案:

答案 0 :(得分:3)

new Thread(Sub() EmailController.sendMail(reasonId, email, message)).Start()