title: sharing class variable between async method and normal return method
body: <p>here is my class, have a async method and get method</p>
  
  <pre><code>class Webservice
  {
      public string token;
      public async void login (string url)
      {
          Console.WriteLine(url);
          var client = new HttpClient();
  
          // Create the HttpContent for the form to be posted.
          string username = ConfigurationSettings.AppSettings["email"];
          string password = ConfigurationSettings.AppSettings["password"];
  
          var requestContent = new FormUrlEncodedContent(new[] {
                  new KeyValuePair&lt;string, string&gt;("email", username),
                  new KeyValuePair&lt;string, string&gt;("password", password),
          });
  
          // Get the response.
          HttpResponseMessage response = await client.PostAsync(url, requestContent);
  
          // Get the response content.
          HttpContent responseContent = response.Content;
  
          // Get the stream of the content.
          using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
          {
              // Write the output.
              //Console.WriteLine(await reader.ReadToEndAsync());
              token = await reader.ReadToEndAsync();
  
          }
      }
  
  
      public string getToken (string url)
      {
          this.login(url);
          Console.WriteLine(token);
          return token+"abc";
      }
  </code></pre>
  
  <p>the token = await reader.ReadToEndAsync(); can't set the class variable or maybe set after getToken was returned, anyone know how to deal with this situation?</p>