1

I get the following error. I did some searching and found out that I can solve this with Tuple. However, I am already returning Task<Country> from my function. In my code the out parameter returns out List<Dictionary<string, int>>. How can I alter my code so it also outs out List<Dictionary<string, int>> without affecting the existing functionality of the function. Help.

Suppression State Error Async methods cannot have ref or out parameters

 public async Task<Country> GetCountriesAsync(int countryId, ICollection<People> peeps, out List<Dictionary<string, int>> PresidentList)
{
      Dictionary<string, int> presi= new Dictionary<string, int>();
      presi.Add("presi", 1);
      PresidentList.Add(presi);
}
Illep
  • 16,375
  • 46
  • 171
  • 302
  • See https://stackoverflow.com/questions/18716928/how-to-write-a-async-method-with-out-parameter – Rui Jarimba Jul 06 '18 at 16:40
  • 1
    @DaisyShipton Yes. In my question I have said that I am returning `Country` already and don't know how to use a tuple. May be there's a different way or maybe I don';t understand how it is done. Can someone else help me here... ? – Illep Jul 06 '18 at 16:43
  • Learn to use a tuple.. the linked question @rui-jarimba supplied has an example. – Dan Jul 06 '18 at 17:08
  • @Dan haha. Yes Sir. I will! – Illep Jul 06 '18 at 17:09

0 Answers0