0

I have a dumb question, but I dont know how to solve it.

List<Currency> currencies = new List<Currency>();
var responseStream = await response.Content.ReadAsStreamAsync();
currencies = await JsonSerializer.DeserializeAsync(responseStream, Currency);

red line below Currency - currency is a type which is noit valid in a given context.

I tried typeof(Currency), also, new Currency() and nothjing.. Im aware that I need to pass a return type of model.

dbc
  • 104,963
  • 20
  • 228
  • 340
Stefan0309
  • 1,602
  • 5
  • 23
  • 61
  • 6
    currencies = await JsonSerializer.DeserializeAsync>(responseStream); // try this – Ctznkane525 Mar 04 '21 at 23:31
  • 2
    And there's no need to allocate a `new List();` beforehand either, just do `var currencies = await JsonSerializer.DeserializeAsync>(responseStream);` – dbc Mar 04 '21 at 23:38

0 Answers0