I am trying to use the following method in a WPF application .NET Framework 4 Client Profile
but I receive this error:
The type or namespace name 'async' could not be found
I am using
using System.Threading.Tasks;
Any idea what could be wrong? Thanks in advance
private async Task SumPageSizesAsync()
{
HttpClient client = new HttpClient();
Task<byte[]> getContentsTask = client.GetByteArrayAsync(url);
byte[] urlContents = await getContentsTask;
}
I am using VS 2010
Well, there are two things:
Microsoft.Bcl.Async
NuGet package to bring in the appropriate library support for .NET 4.See more on this question at Stackoverflow