Skip to main content
deleted 1250 characters in body
Source Link
dr.null
  • 4.8k
  • 3
  • 13
  • 27
Public Sub Main()
    Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                                 .ContinueWith(Sub(t2 As Task(Of IEnumerable(Of Integer)))
                                                   For Each item As Integer In t2.Result
                                                       Console.WriteLine(item)
                                                   Next item
                                               End Sub)
End Sub
Public Sub Main()
    Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(
    Sub(t2 As Task(Of IEnumerable(Of Integer)))
        For Each item As Integer In t2.Result
            Console.WriteLine(item)
        Next item
    End Sub)
End Sub
    Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                                 .ContinueWith(Sub(t2 As Task(Of IEnumerable(Of Integer)))
                                                   Console.WriteLine("Error in Task 1")
                                               End Sub, TaskContinuationOptions.OnlyOnFaulted) _
                                 .ContinueWith(Sub(t3 As Task(Of IEnumerable(Of Integer)))
                                                   For Each item As Integer In t3.Result
                                                       Console.WriteLine(item)
                                                   Next item
                                               End Sub)
Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(
    Sub(t2 As Task(Of IEnumerable(Of Integer)))
        Console.WriteLine("Error in Task 1")
    End Sub, TaskContinuationOptions.OnlyOnFaulted).
    ContinueWith(
    Sub(t3 As Task(Of IEnumerable(Of Integer)))
        For Each item As Integer In t3.Result
            Console.WriteLine(item)
        Next item
    End Sub)
Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                             .ContinueWith(Of Exception)(Function(t2 As Task(Of IEnumerable(Of Integer))) As Exception
                                                             Try
                                                                 For Each item As Integer In t2.Result
                                                                     Console.WriteLine(item)
                                                                 Next item

                                                                 Return Nothing
                                                             Catch ex As Exception
                                                                 Return ex
                                                             End Try
                                                         End Function) _
                             .ContinueWith(Sub(t3 As Task(Of Exception))
                                               If t3.Result IsNot Nothing Then
                                                   Console.WriteLine(t3.Result.Message)
                                               End If
                                           End Sub)
Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(Of Exception)(
    Function(t2 As Task(Of IEnumerable(Of Integer))) As Exception
        Try
            For Each item As Integer In t2.Result
                Console.WriteLine(item)
            Next item

            Return Nothing
        Catch ex As Exception
            Return ex
        End Try
    End Function).
    ContinueWith(
    Sub(t3 As Task(Of Exception))
        If t3.Result IsNot Nothing Then
            Console.WriteLine(t3.Result.Message)
        End If
    End Sub)
Public Sub Main()
    Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                                 .ContinueWith(Sub(t2 As Task(Of IEnumerable(Of Integer)))
                                                   For Each item As Integer In t2.Result
                                                       Console.WriteLine(item)
                                                   Next item
                                               End Sub)
End Sub
    Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                                 .ContinueWith(Sub(t2 As Task(Of IEnumerable(Of Integer)))
                                                   Console.WriteLine("Error in Task 1")
                                               End Sub, TaskContinuationOptions.OnlyOnFaulted) _
                                 .ContinueWith(Sub(t3 As Task(Of IEnumerable(Of Integer)))
                                                   For Each item As Integer In t3.Result
                                                       Console.WriteLine(item)
                                                   Next item
                                               End Sub)
Dim t1 As Task = Task.Factory.StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData) _
                             .ContinueWith(Of Exception)(Function(t2 As Task(Of IEnumerable(Of Integer))) As Exception
                                                             Try
                                                                 For Each item As Integer In t2.Result
                                                                     Console.WriteLine(item)
                                                                 Next item

                                                                 Return Nothing
                                                             Catch ex As Exception
                                                                 Return ex
                                                             End Try
                                                         End Function) _
                             .ContinueWith(Sub(t3 As Task(Of Exception))
                                               If t3.Result IsNot Nothing Then
                                                   Console.WriteLine(t3.Result.Message)
                                               End If
                                           End Sub)
Public Sub Main()
    Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(
    Sub(t2 As Task(Of IEnumerable(Of Integer)))
        For Each item As Integer In t2.Result
            Console.WriteLine(item)
        Next item
    End Sub)
End Sub
Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(
    Sub(t2 As Task(Of IEnumerable(Of Integer)))
        Console.WriteLine("Error in Task 1")
    End Sub, TaskContinuationOptions.OnlyOnFaulted).
    ContinueWith(
    Sub(t3 As Task(Of IEnumerable(Of Integer)))
        For Each item As Integer In t3.Result
            Console.WriteLine(item)
        Next item
    End Sub)
Dim t1 As Task = Task.Factory.
    StartNew(Of IEnumerable(Of Integer))(AddressOf GetAllData).
    ContinueWith(Of Exception)(
    Function(t2 As Task(Of IEnumerable(Of Integer))) As Exception
        Try
            For Each item As Integer In t2.Result
                Console.WriteLine(item)
            Next item

            Return Nothing
        Catch ex As Exception
            Return ex
        End Try
    End Function).
    ContinueWith(
    Sub(t3 As Task(Of Exception))
        If t3.Result IsNot Nothing Then
            Console.WriteLine(t3.Result.Message)
        End If
    End Sub)
edited tags; edited tags
Link
braX
  • 11.9k
  • 5
  • 24
  • 38
edited tags
Link
Progman
  • 20.1k
  • 7
  • 58
  • 88
Source Link
Nostromo
  • 1.3k
  • 12
  • 40
Loading