Posted at

LINQと匿名関数でほげ

More than 3 years have passed since last update.

C#、使ってるとけっこう楽しいよね。

var elems = new string[]{ "a001", "a002", "ccc", "ddd", "a003", "fff", "ggg" };

Func<string, bool> f = (string s ) =>
{
return ("a" == s.Substring(0, 1));
};

var result = elems.Where(x => f(x));

Console.WriteLine(string.Join(",", result));