With multiple variables C# with Example



With multiple variables C# with Example

static int Sum(int a, int b) 
{ 
return a + b; 
} 
static int Multiplication(int a, int b) 
{ 
return a * b; 
} 
static void Main(string[] args) 
{ 
 

Func method = Sum; 
// method points to the Sum method 
// that retuns 1 int variable and takes 2 int variables 
int sum = method(1, 1); 
method = Multiplication; 
// now method points to the Multiplication method 
int multiplication = method(1, 1); 
} 

0 Comment's

Comment Form