bate's blog

調べたこと実装したことなどを取りとめもなく書きます。

簡単なラムダ式

サンプルまるパクリ。
型定義をして、変数に処理を代入して、引数を入れて実行みたいな感じ。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        delegate bool CheckLength(int x, string s);
        static void Main(string[] args)
        {
            CheckLength chk = (int x, string s) => s.Length > x;
            Console.WriteLine(chk(4, "abcde"));
            Console.ReadLine();
        }
    }
}