////이벤트
//using System;
//namespace EventTest
//{
// delegate void EventHandler(string message);
// class MyNotifier
// {
// public event EventHandler SomethingHappened;
// public void DoSomething(int number)
// {
// int temp = number % 10;
// if (temp != 0 && temp % 3 == 0)
// {
// SomethingHappened(String.Format("{0}:짝", number));
// }
// }
// }
// class MainApp
// {
// static public void MyHandler(string message)
// {
// Console.WriteLine(message);
// }
// static void Main(string[] args)
// {
// MyNotifier notifier = new MyNotifier();
// notifier.SomethingHappened += new EventHandler(MyHandler);
// for (int i = 1; i < 30; i++)
// {
// notifier.DoSomething(i);
// }
// }
// }
//}
////람다식
//using System;
//namespace SimpleLamda
//{
// class MainApp
// {
// delegate int Calculate(int a , int b);
// static void Main(string[] args)
// {
// Calculate Calc = (a,b) =>a+b;
// Console.WriteLine("{0}+{1}={2}" , 3,4,Calc(3,4));
// }
// }
//}
////문 형식의 람다식
//using System;
//namespace StatementLamda
//{
// class MainApp
// {
// delegate string Concatenate(string[] args);
// static void Main(string[] args)
// {
// Concatenate concat = (arr) =>
// {
// string result = “”;
// foreach (string s in arr)
// result += s;
// return result;
// };
// Console.WriteLine ( concat(args));
// }
// }
//}
////Func 델리게이트
//using System;
//namespace FuncTest
//{
// class MainApp
// {
// static void Main(string[] args)
// {
// Func func1 = () => 10;
// Console.WriteLine(“func1() : {0}”, func1());
// Func<int, int> func2 = (x) => x * 2;
// Console.WriteLine(“func2(4): {0}”, func2(4));
// Func<double, double, double> func3 = (x, y) => x / y;
// Console.WriteLine(“func3(22/7) : {0}”, func3(22, 7));
// }
// }
//}
////Action 델리게이트
//using System;
//namespace ActionTest
//{
// class MainApp
// {
// static void Main(string[] args)
// {
// Action act1 = () => Console.WriteLine(“Action()”);
// act1();
// int result = 0;
// Action act2 = (x) => result = x * x;
// act2(3);
// Console.WriteLine(“result : {0}”, result);
// Action<double, double> act3 = (x, y) =>
// {
// double pi = x/y;
// Console.WriteLine(“Action<T1,T2>({0},{1}) : {2}”, x, y, pi);
// };
// act3(22.0, 7.0);
// }
// }
//}
////식 트리
//using System;
//using System.Linq.Expressions;
//namespace UsingExpressionTree
//{
// class MainApp
// {
// static void Main(string[] args)
// {
// //1 *2+(x-y)
// Expression const1 = Expression.Constant(1);
// Expression const2 = Expression.Constant(2);
// Expression leftExp = Expression.Multiply(const1, const2);
// Expression param1 = Expression.Parameter(typeof(int)); //x를 위한 변수
// Expression param2 = Expression.Parameter(typeof(int));//y를 위한 변수
// Expression rightExp = Expression.Subtract(param1, param2);
// Expression exp = Expression.Add(leftExp, rightExp);
// Expression<Func<int, int, int» expression = Expression<Func<int, int, int».Lambda<Func<int, int, int»
// (exp, new ParameterExpression[] { (ParameterExpression)param1, (ParameterExpression)param2 });
// Func<int, int, int> func = expression.Compile();
// Console.WriteLine(“1*2+({0}-{1}) = {2}”, 7, 8, func(7, 8));
// }
// }
//}
////람다식을 이용한 식 트리
//using System;
//using System.Linq.Expressions;
//namespace ExpressionTreeViaLamda
//{
// class MainApp
// {
// static void Main(string[] args)
// {
// Expression<Func<int, int, int» expression = (a, b) => 1 * 2 + (a - b);
// Func<int, int, int> func = expression.Compile();
// Console.WriteLine(“1*2+({0}-{1})-{2}”, 7, 8, func(7, 8));
// }
// }
//}