First create a delegate Transformer:
delegate int Transformer (int i);
- Transformer square = delegate(int x){return x * x;};
- this statement can be simplied to :
- Transformer square = (int x ) => {return x * x;}
- OR
- Transformer squere = x => x* x;
call square:
Console.WriteLine(square(5));
No comments:
Post a Comment