Advertisement
Guest User

Untitled

a guest
Feb 4th, 2016
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.15 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: ClassLibrary1.Class1
  3. // Assembly: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 4808968B-2F48-4EC7-9B71-80CAAA924B02
  5. // Assembly location: C:\Users\mwarpool\Desktop\ClassLibrary1.dll
  6. // Compiler-generated code is shown
  7.  
  8. using System;
  9. using System.Diagnostics;
  10. using System.Runtime.CompilerServices;
  11. using System.Runtime.InteropServices;
  12. using System.Threading.Tasks;
  13.  
  14. namespace ClassLibrary1
  15. {
  16.   public class Class1
  17.   {
  18.     public Class1()
  19.     {
  20.       base.\u002Ector();
  21.     }
  22.  
  23.     public Task<string> DoSomething()
  24.     {
  25.       Class1.\u003CDoSomething\u003Ed__0 stateMachine;
  26.       stateMachine.\u003C\u003E4__this = this;
  27.       stateMachine.\u003C\u003Et__builder = AsyncTaskMethodBuilder<string>.Create();
  28.       stateMachine.\u003C\u003E1__state = -1;
  29.       stateMachine.\u003C\u003Et__builder.Start<Class1.\u003CDoSomething\u003Ed__0>(ref stateMachine);
  30.       return stateMachine.\u003C\u003Et__builder.Task;
  31.     }
  32.  
  33.     private Task<string> DoSomethingElse()
  34.     {
  35.       return Task.FromResult<string>("test");
  36.     }
  37.  
  38.     [CompilerGenerated]
  39.     [StructLayout(LayoutKind.Auto)]
  40.     private struct \u003CDoSomething\u003Ed__0 : IAsyncStateMachine
  41.     {
  42.       public int \u003C\u003E1__state;
  43.       public AsyncTaskMethodBuilder<string> \u003C\u003Et__builder;
  44.       public Class1 \u003C\u003E4__this;
  45.       private TaskAwaiter<string> \u003C\u003Eu__\u0024awaiter1;
  46.       private object \u003C\u003Et__stack;
  47.  
  48.       void IAsyncStateMachine.MoveNext()
  49.       {
  50.         string result1;
  51.         try
  52.         {
  53.           bool flag = true;
  54.           TaskAwaiter<string> awaiter;
  55.           switch (this.\u003C\u003E1__state)
  56.           {
  57.             case -3:
  58.               goto label_6;
  59.             case 0:
  60.               awaiter = this.\u003C\u003Eu__\u0024awaiter1;
  61.               this.\u003C\u003Eu__\u0024awaiter1 = new TaskAwaiter<string>();
  62.               this.\u003C\u003E1__state = -1;
  63.               break;
  64.             default:
  65.               awaiter = this.\u003C\u003E4__this.DoSomethingElse().GetAwaiter();
  66.               if (!awaiter.IsCompleted)
  67.               {
  68.                 this.\u003C\u003E1__state = 0;
  69.                 this.\u003C\u003Eu__\u0024awaiter1 = awaiter;
  70.                 this.\u003C\u003Et__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, Class1.\u003CDoSomething\u003Ed__0>(ref awaiter, ref this);
  71.                 flag = false;
  72.                 return;
  73.               }
  74.               break;
  75.           }
  76.           string result2 = awaiter.GetResult();
  77.           TaskAwaiter<string> taskAwaiter = new TaskAwaiter<string>();
  78.           result1 = result2;
  79.         }
  80.         catch (Exception ex)
  81.         {
  82.           this.\u003C\u003E1__state = -2;
  83.           this.\u003C\u003Et__builder.SetException(ex);
  84.           return;
  85.         }
  86. label_6:
  87.         this.\u003C\u003E1__state = -2;
  88.         this.\u003C\u003Et__builder.SetResult(result1);
  89.       }
  90.  
  91.       [DebuggerHidden]
  92.       void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine param0)
  93.       {
  94.         this.\u003C\u003Et__builder.SetStateMachine(param0);
  95.       }
  96.     }
  97.   }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement