using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HelloWorld
{
class App
{
//생성자
public App()
{
Random rand = new Random();
Func<int, int, int> getRandNum = (a, b) => { return rand.Next(a, b); };
int randNum = getRandNum(1, 100);
Console.WriteLine(randNum); //1 ~ 100사이 랜덤 숫자 (정수)
}
}
}
'C# > 수업 내용' 카테고리의 다른 글
람다식 연습 8 (Action) (0) | 2021.12.24 |
---|---|
람다식 연습 7 (Func) - 피자 (0) | 2021.12.24 |
람다식 연습 5 (Func) 두 수 더하기 (0) | 2021.12.24 |
람다식 연습 4 (Func) 장검 (0) | 2021.12.24 |
람다식 연습 3 (Action) - 빵만들기 (0) | 2021.12.24 |