diff --git a/LanguageFeatures/LanguageFeatures.csproj b/LanguageFeatures/LanguageFeatures.csproj index f5b2cef..ad7abb7 100644 --- a/LanguageFeatures/LanguageFeatures.csproj +++ b/LanguageFeatures/LanguageFeatures.csproj @@ -98,6 +98,7 @@ Global.asax + diff --git a/LanguageFeatures/Models/MyAsyncMethods.cs b/LanguageFeatures/Models/MyAsyncMethods.cs new file mode 100644 index 0000000..9420d68 --- /dev/null +++ b/LanguageFeatures/Models/MyAsyncMethods.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +using System.Net.Http; +using System.Threading.Tasks; + +namespace LanguageFeatures.Models +{ + public class MyAsyncMethods + { + public static Task GetPageLength() + { + HttpClient client = new HttpClient(); + var httpTask = client.GetAsync("http://apress.com"); + + // another task while completing http request. + + return httpTask.ContinueWith((Task antecedent) => + { + return antecedent.Result.Content.Headers.ContentLength; + }); + } + } +} \ No newline at end of file