Skip to content

Instantly share code, notes, and snippets.

@mabster
Created June 1, 2012 08:13
Show Gist options
  • Save mabster/2850198 to your computer and use it in GitHub Desktop.
Save mabster/2850198 to your computer and use it in GitHub Desktop.
Awaiting a call in an anonymous type initializer
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Loaded += MainWindow_Loaded;
}
async void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = new
{
Tweets = (await new TwitterAnonymousClient().GetUserTimelineAsync("mabster", 50)).Result,
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment