LoginSignup
2
1

More than 5 years have passed since last update.

LINQと匿名関数でほげ

Posted at

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));

2
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1