Skip to content

Instantly share code, notes, and snippets.

View kolosovpetro's full-sized avatar

Petro Kolosov kolosovpetro

View GitHub Profile
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);
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));
}
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;