Asynchrony with Async/Await
The Async
/Await
pattern has the goal of simplifying the way developers write asynchronous code. You will learn a lot about the underlying infrastructure, but before digging into that, it is important for you to see how your code can be much cleaner and readable. Let’s start by modifying the QueryVideos
method to make some important considerations:
Private Async Function QueryVideosAsync() As _ Task(Of IEnumerable(Of Video)) Dim client As New WebClient Dim data = Await client.DownloadStringTaskAsync(New Uri(Video.FeedUrl)) Dim doc = XDocument.Parse(data) Dim query = From video In doc...<item> Select New Video With { .Title = video.<title>.Value, ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.