「C#」引数なし、戻り値なしAction型の変数を使用

2021年9月19日

書式
Action cft = () =>処理コード
引数なし、戻り値なし

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
using System;
class Program
{
static void Main(string[] args)
{
Action cft = () => Console.WriteLine("hello world");
cft();
}
}
using System; class Program { static void Main(string[] args) { Action cft = () => Console.WriteLine("hello world"); cft(); } }
using System;

    class Program
    {
        static void Main(string[] args)
        {
        Action cft = () => Console.WriteLine("hello world");
        cft();
    }
    }

結果
hello world

C#

Posted by arkgame