Action:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
internal class Program
{
static Action<string> test=new Action<string>(ShowABC);
static void Main(string[] args)
{
test?.Invoke("Abc");
Console.ReadKey();
}
static void ShowABC(string abc)
{
Console.WriteLine("ABC");
}
}
}
delegate:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
internal class Program
{
delegate void MyAction(string abc);
static MyAction test = new MyAction(ShowABC);
static void Main(string[] args)
{
test?.Invoke("Abc");
Console.ReadKey();
}
static void ShowABC(string abc)
{
Console.WriteLine("ABC");
}
}
}