O'Reilly logo
  • Edwin Lobos thinks this is interesting:

public async virtual Task<T> GetAllAsync(string requestUri) { string json = await GetInternalAsync(requestUri); return JsonConvert.DeserializeObject<IEnumerable<T>>(json); }


Cover of Professional C# 6 and .NET Core 1.0


This method will raise an error because the return type is Task<T> but we're trying to return IEnumerable<T>. The correction is to change the return type in the method signature to Task<IEnumerable<T>>.