Action대리자: Func대리자와 거의 똑같지만 반환형식이 없음
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp16 { class Program { static void Main(string[] args) { /*Action람다식*/ Action act1 = () => Console.WriteLine("Action()"); act1(); int result = 0; Actionact2= (x)=> result =x* x; act2(3); Console.WriteLine(re); Action act3 = (x, y) => { double pi = x / y; Console.WriteLine(pi); }; act3(22.0, 7.0); } } }
'코딩연습 > C#' 카테고리의 다른 글
[C#]람다식을 이용하여 계산기 클래스 만들기 (0) | 2020.06.15 |
---|---|
[C#]식트리 (0) | 2020.06.15 |
[C#]람다식(Func대리자) (0) | 2020.06.15 |
[C#]LINQ연습문제(레코드조회) (0) | 2020.06.12 |
[C#]LINQ (0) | 2020.06.12 |