1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2025-06-07 07:56:14 +00:00
This commit is contained in:
wook 2017-04-03 03:15:06 +09:00
parent 58d04197ee
commit ffff01117a
2 changed files with 27 additions and 0 deletions

View File

@ -98,6 +98,7 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\MyAsyncMethods.cs" />
<Compile Include="Models\MyExtensionMethods.cs" />
<Compile Include="Models\Product.cs" />
<Compile Include="Models\ShoppingCart.cs" />

View File

@ -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<long?> GetPageLength()
{
HttpClient client = new HttpClient();
var httpTask = client.GetAsync("http://apress.com");
// another task while completing http request.
return httpTask.ContinueWith((Task<HttpResponseMessage> antecedent) =>
{
return antecedent.Result.Content.Headers.ContentLength;
});
}
}
}