using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public delegate void 代理(int i);
public partial class Form1 : Form
{
public void show(int i)
{
Console.WriteLine($"=={i}=====");
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
代理 da = new 代理(show);
for(int i=0; i<10; i++)
da.Invoke(i);
}
private void button2_Click(object sender, EventArgs e)
{
Action<string> act = x => Console.WriteLine($"show{x}");
act.Invoke("12121212");
}
}
}
Invoke = 召唤
最新推荐文章于 2024-05-21 21:51:58 发布