Last active
January 25, 2016 11:44
-
-
Save khellang/6e7b3bd197657112714c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
public class C | |
{ | |
public async Task<IEnumerable<string>> M() | |
{ | |
return await N(); | |
} | |
public async Task<IEnumerable<string>> N() | |
{ | |
return await Task.FromResult(new[] { "Hello" }); | |
} | |
} | |
// Result: | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
using System.Security.Permissions; | |
using System.Threading.Tasks; | |
[assembly: AssemblyVersion("0.0.0.0")] | |
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] | |
[assembly: CompilationRelaxations(8)] | |
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] | |
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] | |
[module: UnverifiableCode] | |
public class C | |
{ | |
[CompilerGenerated] | |
[StructLayout(LayoutKind.Auto)] | |
private struct <M>d__0 : IAsyncStateMachine | |
{ | |
public int <>1__state; | |
public AsyncTaskMethodBuilder<IEnumerable<string>> <>t__builder; | |
public C <>4__this; | |
private TaskAwaiter<IEnumerable<string>> <>u__1; | |
void IAsyncStateMachine.MoveNext() | |
{ | |
int num = this.<>1__state; | |
IEnumerable<string> result; | |
try | |
{ | |
TaskAwaiter<IEnumerable<string>> taskAwaiter; | |
if (num != 0) | |
{ | |
taskAwaiter = this.<>4__this.N().GetAwaiter(); | |
if (!taskAwaiter.IsCompleted) | |
{ | |
this.<>1__state = 0; | |
this.<>u__1 = taskAwaiter; | |
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<IEnumerable<string>>, C.<M>d__0>(ref taskAwaiter, ref this); | |
return; | |
} | |
} | |
else | |
{ | |
taskAwaiter = this.<>u__1; | |
this.<>u__1 = default(TaskAwaiter<IEnumerable<string>>); | |
this.<>1__state = -1; | |
} | |
IEnumerable<string> arg_6F_0 = taskAwaiter.GetResult(); | |
taskAwaiter = default(TaskAwaiter<IEnumerable<string>>); | |
result = arg_6F_0; | |
} | |
catch (Exception exception) | |
{ | |
this.<>1__state = -2; | |
this.<>t__builder.SetException(exception); | |
return; | |
} | |
this.<>1__state = -2; | |
this.<>t__builder.SetResult(result); | |
} | |
[DebuggerHidden] | |
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) | |
{ | |
this.<>t__builder.SetStateMachine(stateMachine); | |
} | |
} | |
[CompilerGenerated] | |
[StructLayout(LayoutKind.Auto)] | |
private struct <N>d__1 : IAsyncStateMachine | |
{ | |
public int <>1__state; | |
public AsyncTaskMethodBuilder<IEnumerable<string>> <>t__builder; | |
private TaskAwaiter<string[]> <>u__1; | |
void IAsyncStateMachine.MoveNext() | |
{ | |
int num = this.<>1__state; | |
IEnumerable<string> result; | |
try | |
{ | |
TaskAwaiter<string[]> taskAwaiter; | |
if (num != 0) | |
{ | |
taskAwaiter = Task.FromResult<string[]>(new string[] { | |
"Hello" | |
}).GetAwaiter(); | |
if (!taskAwaiter.IsCompleted) | |
{ | |
this.<>1__state = 0; | |
this.<>u__1 = taskAwaiter; | |
this.<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<string[]>, C.<N>d__1>(ref taskAwaiter, ref this); | |
return; | |
} | |
} | |
else | |
{ | |
taskAwaiter = this.<>u__1; | |
this.<>u__1 = default(TaskAwaiter<string[]>); | |
this.<>1__state = -1; | |
} | |
IEnumerable<string> arg_77_0 = taskAwaiter.GetResult(); | |
taskAwaiter = default(TaskAwaiter<string[]>); | |
result = arg_77_0; | |
} | |
catch (Exception exception) | |
{ | |
this.<>1__state = -2; | |
this.<>t__builder.SetException(exception); | |
return; | |
} | |
this.<>1__state = -2; | |
this.<>t__builder.SetResult(result); | |
} | |
[DebuggerHidden] | |
void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) | |
{ | |
this.<>t__builder.SetStateMachine(stateMachine); | |
} | |
} | |
[AsyncStateMachine(typeof(C.<M>d__0))] | |
public Task<IEnumerable<string>> M() | |
{ | |
C.<M>d__0 <M>d__; | |
<M>d__.<>4__this = this; | |
<M>d__.<>t__builder = AsyncTaskMethodBuilder<IEnumerable<string>>.Create(); | |
<M>d__.<>1__state = -1; | |
AsyncTaskMethodBuilder<IEnumerable<string>> <>t__builder = <M>d__.<>t__builder; | |
<>t__builder.Start<C.<M>d__0>(ref <M>d__); | |
return <M>d__.<>t__builder.Task; | |
} | |
[AsyncStateMachine(typeof(C.<N>d__1))] | |
public Task<IEnumerable<string>> N() | |
{ | |
C.<N>d__1 <N>d__; | |
<N>d__.<>t__builder = AsyncTaskMethodBuilder<IEnumerable<string>>.Create(); | |
<N>d__.<>1__state = -1; | |
AsyncTaskMethodBuilder<IEnumerable<string>> <>t__builder = <N>d__.<>t__builder; | |
<>t__builder.Start<C.<N>d__1>(ref <N>d__); | |
return <N>d__.<>t__builder.Task; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
public class C | |
{ | |
public Task<IEnumerable<string>> M() | |
{ | |
return N(); | |
} | |
public Task<IEnumerable<string>> N() | |
{ | |
return Task.FromResult<IEnumerable<string>>(new[] { "Hello" }); | |
} | |
} | |
// Result: | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Security; | |
using System.Security.Permissions; | |
using System.Threading.Tasks; | |
[assembly: AssemblyVersion("0.0.0.0")] | |
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] | |
[assembly: CompilationRelaxations(8)] | |
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] | |
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] | |
[module: UnverifiableCode] | |
public class C | |
{ | |
public Task<IEnumerable<string>> M() | |
{ | |
return this.N(); | |
} | |
public Task<IEnumerable<string>> N() | |
{ | |
return Task.FromResult<IEnumerable<string>>(new string[] { | |
"Hello" | |
}); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment