title: how to write a getawaiter for vb.net
body: <p>I have a program in vb.net (VS 2017) using 4.7 framework, where a function is taking too long to process, interrupting message pumping and causing a timeout error.  To solve this I want to run the function asynchronously, using tasks and await.  (new to me).  I understand that to do that I need to create an asynchronous function (using the async keyword) which uses await to call another asynchronous function which then does the processing. The problem is how to make my own function asynchronous, which internally uses no predefined asynchronous process called by await.  To do that it seems I need to have a GetAwaiter defined for my function making it callable using await.  Here is where I get stumped.  I have searched the web, and looked for books to cover this topic, and I come up short.  All the web examples are in C# (which I am not very conversant in), and I can't wrap my head around the C# code examples I have found for creating a GetAwaiter.  As an example, from a blog by Stephen Toub there is this:</p>
  
  <pre><code>public static TaskAwaiter GetAwaiter(this DateTimeOffset dateTimeOffset) 
  { 
      return (dateTimeOffset – DateTimeOffset.UtcNow).GetAwaiter(); 
  }
  </code></pre>
  
  <p>to create a GetAwaiter for the DateTimeOffset function.  I don't understand the  declarative line, specifically the TaskAwaiter GetAwaiter twin and the contents of the parenthesis following the GetAwaiter keyword.  I do think that 'this' refers to sender in vb, DateTimeOffset is the name of the function getting the GetAwaiter, and dateTimeOffset is a value being passed, but I don't understand that combination of function names and values inside a paren.  How can this line be rewritten in vb?   Are there any good, comprehensive books, articles, etc covering the task/await functionality - particularly when you have to create a new asynchronous function, one that is not pre-packaged and included as part of .net, and written including vb examples. I found a very informative youtube presentation by Michael Kennedy, but as in all other examples I've found, it relies on a predefined async function that can be called using await.  I need to get my head above water - which way is the surface?</p>