Simple Delegate Example
Simple Delegate Example
using System;
public delegate int Delegatmethod(int a,int b);
public class Sampleclass
{
public int Add(int x,int y)
{
return x+y;
}
public int Sun(int x,int y)
{
return x-y;
}
}
class Program
{
public static void Main(string[] args)
{
Sampleclass ss=new Sampleclass();
Delegatmethod delegate1=ss.Add;
int i=delegate1(10,20);
Console.WriteLine(i);
}
}
Comments
Post a Comment