You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
549 B
28 lines
549 B
using System;
|
|
|
|
namespace Samples.Calculate
|
|
{
|
|
class CalculateSample
|
|
{
|
|
private delegate int Calculate(int x, int y);
|
|
|
|
public static int Add(int x, int y)
|
|
{
|
|
return x + y;
|
|
}
|
|
|
|
public static int Subtract(int x, int y)
|
|
{
|
|
return x - y;
|
|
}
|
|
|
|
public static void Sample()
|
|
{
|
|
Calculate calc1 = Add;
|
|
Calculate calc2 = Subtract;
|
|
|
|
Console.WriteLine(calc1(10, 5));
|
|
Console.WriteLine(calc2(10, 5));
|
|
}
|
|
}
|
|
} |