using System;
using System.Collections.Generic;
static class Program
{
static void Main(string[] args)
{
var array = new[] { "hoge", "huga", "tako" };
array.ForEach((s, i) => Console.WriteLine(i + ":" + s));
}
}
static class Extensions
{
public static void ForEach<T>(this IEnumerable<T> source, Action<T, int> action)
{
int i = 0;
foreach (var item in source)
{
action(item, i++);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKCnN0YXRpYyBjbGFzcyBQcm9ncmFtCnsKICAgIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKICAgIHsKICAgICAgICB2YXIgYXJyYXkgPSBuZXdbXSB7ICJob2dlIiwgImh1Z2EiLCAidGFrbyIgfTsKICAgICAgICBhcnJheS5Gb3JFYWNoKChzLCBpKSA9PiBDb25zb2xlLldyaXRlTGluZShpICsgIjoiICsgcykpOwogICAgfQp9CgpzdGF0aWMgY2xhc3MgRXh0ZW5zaW9ucwp7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgRm9yRWFjaDxUPih0aGlzIElFbnVtZXJhYmxlPFQ+IHNvdXJjZSwgQWN0aW9uPFQsIGludD4gYWN0aW9uKQogICAgewogICAgICAgIGludCBpID0gMDsKICAgICAgICBmb3JlYWNoICh2YXIgaXRlbSBpbiBzb3VyY2UpCiAgICAgICAgewogICAgICAgICAgICBhY3Rpb24oaXRlbSwgaSsrKTsKICAgICAgICB9CiAgICB9Cn0KCg==