I'm used to working with the Scala programming language - using Scala, I could map futures, for example:
val response: Future[HttpResponse] = asyncHttpClient.GetRequest("www.google.com")
val statusCode: Future[Int] = response.map(r => r.statusCode)
Recently, I picked up work with C #, and I saw myself in the same situation as in the example above, however, I could not understand how to "map" the task.
Here is an example of what I want to achieve:
Task<HttpResponseMessage> response = httpClient.GetAsync("www.google.com")
Task<int> statusCode = response.Map(response => response.StatusCode)
thank
source
share