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.Linq; | |
| public class C { | |
| public void M() { | |
| var col = Collection().ToList(); | |
| foreach(var item in col) | |
| { | |
| Console.WriteLine(item); |
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; | |
| public class C { | |
| public void M() { | |
| var actions = new List<Action>(); | |
| for(var i = 0; i<10; i++) | |
| { | |
| actions.Add(() => Console.WriteLine(i)); | |
| } |
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; | |
| public class CustomEnumerable | |
| { | |
| // A custom enumerator which has a Current property and a MoveNext() method, but does NOT implement IEnumerator. | |
| public class CustomEnumerator | |
| { | |
| private readonly CustomEnumerable _enumerable; | |
| private int _index = -1; |
NewerOlder