Advertisement
Guest User

to Stephen

a guest
Jul 24th, 2014
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. class TestObj : IDisposable
  2. {
  3.     private TaskCompletionSource<int> tcs;
  4.  
  5.     public TestObj()
  6.     {
  7.         tcs = new TaskCompletionSource<int>();
  8.     }
  9.  
  10.     public void Dispose()
  11.     {
  12.         tcs.TrySetException(new AmbiguousMatchException());
  13.         //tcs.TrySetCanceled();
  14.     }
  15. }
  16.  
  17. public partial class MainPage
  18. {
  19.     // Constructor
  20.     public MainPage()
  21.     {
  22.         InitializeComponent();
  23.     }
  24.  
  25.     protected override void OnNavigatedTo(NavigationEventArgs e)
  26.     {
  27.         base.OnNavigatedTo(e);
  28.  
  29.         for (int i = 0; i < 100000; i++)
  30.         {
  31.             using (var obj = new TestObj())
  32.             {
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement