Guest User

Untitled

a guest
Apr 30th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private async void button1_Click(object sender, EventArgs e)
  21.         {
  22.             try
  23.             {
  24.                 String str = await Test();
  25.                 Console.WriteLine(str);
  26.             }
  27.             catch (Exception ex)
  28.             {
  29.                 Console.WriteLine(ex.ToString());
  30.             }
  31.         }
  32.  
  33.         async Task<String> Test()
  34.         {
  35.             throw new Exception("lalala");
  36.         }
  37.     }
  38. }
Add Comment
Please, Sign In to add comment