Skip to content

Instantly share code, notes, and snippets.

@daanl
Created September 18, 2013 14:23
Show Gist options
  • Save daanl/6609916 to your computer and use it in GitHub Desktop.
Save daanl/6609916 to your computer and use it in GitHub Desktop.
class Program
{
public static List<string> ScreenInformation = new List<string>
{
"hi",
"oi",
"whats",
"up"
};
static void Main(string[] args)
{
var task = LoadRecordScreenAsync();
task.Wait();
var result = task.Result;
}
private static async Task<IEnumerable<ScreenViewModel>> LoadRecordScreenAsync()
{
List<ScreenViewModel> screens = new List<ScreenViewModel>();
foreach (var info in ScreenInformation)
{
ScreenViewModel vm = await GetScreenViewModelAsync(info);
screens.Add(vm);
}
return screens;
}
public static Task<ScreenViewModel> GetScreenViewModelAsync(string screenInfo)
{
return Task<ScreenViewModel>.Factory.StartNew(() =>
{
return new ScreenViewModel();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment