在Nito.AsyncEx中找不到Bootstrapper类

时间:2014-12-22 10:54:40

标签: vb.net

请参阅以下问题的答案:Can't specify the 'async' modifier on the 'Main' method of a console app

我正在尝试使用VB.NET程序。我已经使用NUGET添加了包,并确保添加了Reference。请参阅以下代码:

Imports Nito.AsyncEx

Public Class ScheduledTasks
    Private Shared Async Sub MainAsync(args As String())
        Dim bs As New Bootstrapper()
        Dim list As VariantType = Await bs.GetList()
    End Sub
End Class

错误是:找不到类型BootStrapper。我用Intellisense来查看Nito中包含的类型.AsyncEx和Bootstapper不存在?如何使用VB.NET创建异步主方法?

1 个答案:

答案 0 :(得分:0)

Bootstrapper不是AsyncEx的一部分。 AsyncContext是:

Imports Nito.AsyncEx

Public Class Program
    Private Shared Sub Main(args As String())
        AsyncContext.Run(Function() MainAsync(args))
    End Sub
    Private Shared Function MainAsync(args As String()) As Task
        ...
    End Function
End Class