Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled with JetBrains decompiler
- // Type: ClassLibrary1.Class1
- // Assembly: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
- // MVID: 4808968B-2F48-4EC7-9B71-80CAAA924B02
- // Assembly location: C:\Users\mwarpool\Desktop\ClassLibrary1.dll
- // Compiler-generated code is shown
- using System;
- using System.Diagnostics;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Threading.Tasks;
- namespace ClassLibrary1
- {
- public class Class1
- {
- public Class1()
- {
- base.\u002Ector();
- }
- public Task<string> DoSomething()
- {
- Class1.\u003CDoSomething\u003Ed__0 stateMachine;
- stateMachine.\u003C\u003E4__this = this;
- stateMachine.\u003C\u003Et__builder = AsyncTaskMethodBuilder<string>.Create();
- stateMachine.\u003C\u003E1__state = -1;
- stateMachine.\u003C\u003Et__builder.Start<Class1.\u003CDoSomething\u003Ed__0>(ref stateMachine);
- return stateMachine.\u003C\u003Et__builder.Task;
- }
- private Task<string> DoSomethingElse()
- {
- return Task.FromResult<string>("test");
- }
- [CompilerGenerated]
- [StructLayout(LayoutKind.Auto)]
- private struct \u003CDoSomething\u003Ed__0 : IAsyncStateMachine
- {
- public int \u003C\u003E1__state;
- public AsyncTaskMethodBuilder<string> \u003C\u003Et__builder;
- public Class1 \u003C\u003E4__this;
- private TaskAwaiter<string> \u003C\u003Eu__\u0024awaiter1;
- private object \u003C\u003Et__stack;
- void IAsyncStateMachine.MoveNext()
- {
- string result1;
- try
- {
- bool flag = true;
- TaskAwaiter<string> awaiter;
- switch (this.\u003C\u003E1__state)
- {
- case -3:
- goto label_6;
- case 0:
- awaiter = this.\u003C\u003Eu__\u0024awaiter1;
- this.\u003C\u003Eu__\u0024awaiter1 = new TaskAwaiter<string>();
- this.\u003C\u003E1__state = -1;
- break;
- default:
- awaiter = this.\u003C\u003E4__this.DoSomethingElse().GetAwaiter();
- if (!awaiter.IsCompleted)
- {
- this.\u003C\u003E1__state = 0;
- this.\u003C\u003Eu__\u0024awaiter1 = awaiter;
- this.\u003C\u003Et__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string>, Class1.\u003CDoSomething\u003Ed__0>(ref awaiter, ref this);
- flag = false;
- return;
- }
- break;
- }
- string result2 = awaiter.GetResult();
- TaskAwaiter<string> taskAwaiter = new TaskAwaiter<string>();
- result1 = result2;
- }
- catch (Exception ex)
- {
- this.\u003C\u003E1__state = -2;
- this.\u003C\u003Et__builder.SetException(ex);
- return;
- }
- label_6:
- this.\u003C\u003E1__state = -2;
- this.\u003C\u003Et__builder.SetResult(result1);
- }
- [DebuggerHidden]
- void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine param0)
- {
- this.\u003C\u003Et__builder.SetStateMachine(param0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement