main
syneffort 2 years ago
parent 63fe8e15d1
commit 68d927d59e
  1. 32
      BasicGramms/BasicGramms/BasicLambda.cs
  2. 7
      BasicGramms/BasicGramms/Program.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BasicGramms
{
internal class BasicLambda
{
private delegate int Calc(int x, int y);
private delegate void CalcVoid() ;
public void DoTest()
{
// lambda
Calc cal = (int x, int y) => x + y;
Console.WriteLine(cal(2, 5));
// anonymous method
cal = delegate (int x, int y)
{
return x + y;
};
Console.WriteLine(cal(10, 7));
CalcVoid calcVoid = () => Console.WriteLine("This is void lambda");
calcVoid();
}
}
}

@ -16,8 +16,11 @@ namespace BasicGramms
//BasicEvent evt = new BasicEvent();
//evt.DoTest();
BasicEventUser evtUser = new BasicEventUser();
evtUser.DoTest();
//BasicEventUser evtUser = new BasicEventUser();
//evtUser.DoTest();
BasicLambda lambda = new BasicLambda();
lambda.DoTest();
Console.ReadKey();
}

Loading…
Cancel
Save