using System;
namespace MyCompiler {
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello world!");
del obj = new del();
del.mindelegate delg = new del.mindelegate(obj.add);
Console.WriteLine("I am custom delegate {0}",delg(3,4));
Func<int,int,int> func = new Func<int,int,int>(obj.add);
Console.WriteLine("I am Func {0}",func(-34,-56));
int z = 0;
Func<int,int,int> func2 = (x,y) =>
{
z = x +y;
return Math.Max(x,y);
};
Console.WriteLine("I am Func2 {0} \nvalue stored in z :- {1}",func2.Invoke(23,898),z);
}
}
public class del
{
public delegate int mindelegate(int x,int y);
public int add(int par1, int par2)
{
return Math.Min(par1,par2);
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: