using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
public async static Task Main()
foreach (var carSync in foo.CarsSync)
Console.WriteLine(carSync.Text);
foreach (var carSync in foo.CarsAsync)
Console.WriteLine(carSync.Text);
public IList<Cars> CarsSync { get; set; }
public IList<Cars> CarsAsync { get; set; }
CarsSync = GetCars(true).Result.Values.ToList();
public async Task LoadAsync()
var dictionary = await GetCars(false);
CarsAsync = dictionary.Values.ToList();
public Task<Dictionary<long, Cars>> GetCars(bool isSync)
return new Dictionary<long, Cars>(){
{1, new Cars($"Car 1 | IsSync = {isSync}")},
{2, new Cars($"Car 2 | IsSync = {isSync}")},
public string Text { get; set; }