Created
March 20, 2021 09:52
-
-
Save kolosovpetro/f847762d967c0b3cd89891bd286eaded to your computer and use it in GitHub Desktop.
This file contains 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; | |
public class C { | |
public void M() { | |
var actions = new List<Action>(); | |
for(var i = 0; i<10; i++) | |
{ | |
actions.Add(() => Console.WriteLine(i)); | |
} | |
for(var i = 0; i<10; i++) | |
{ | |
var index = i; | |
actions.Add(() => Console.WriteLine(index)); | |
} | |
} | |
} |
This file contains 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.Diagnostics; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Security; | |
using System.Security.Permissions; | |
[assembly: CompilationRelaxations(8)] | |
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] | |
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] | |
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] | |
[assembly: AssemblyVersion("0.0.0.0")] | |
[module: UnverifiableCode] | |
public class C | |
{ | |
[CompilerGenerated] | |
private sealed class <>c__DisplayClass0_0 | |
{ | |
public int i; | |
internal void <M>b__0() | |
{ | |
Console.WriteLine(i); | |
} | |
} | |
[CompilerGenerated] | |
private sealed class <>c__DisplayClass0_1 | |
{ | |
public int index; | |
internal void <M>b__1() | |
{ | |
Console.WriteLine(index); | |
} | |
} | |
public void M() | |
{ | |
List<Action> list = new List<Action>(); | |
<>c__DisplayClass0_0 <>c__DisplayClass0_ = new <>c__DisplayClass0_0(); | |
<>c__DisplayClass0_.i = 0; | |
while (<>c__DisplayClass0_.i < 10) | |
{ | |
list.Add(new Action(<>c__DisplayClass0_.<M>b__0)); | |
<>c__DisplayClass0_.i++; | |
} | |
int num = 0; | |
while (num < 10) | |
{ | |
<>c__DisplayClass0_1 <>c__DisplayClass0_2 = new <>c__DisplayClass0_1(); | |
<>c__DisplayClass0_2.index = num; | |
list.Add(new Action(<>c__DisplayClass0_2.<M>b__1)); | |
num++; | |
} | |
} | |
} |
This file contains 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
{ | |
"version": 1, | |
"target": "C#", | |
"mode": "Debug" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment