public class card
{
public delegate void shua(object txt);
public event shua shuashijian;
public void yanzheng(string num, object txt)
{
if (num == "123")
{
if (shuashijian != null)
{
shuashijian(txt);
}
}
}
}
public class shitang
{
public shitang(card m)
{
m.shuashijian += new card.shua(ob);
}
public void ob(object txt)
{
((TextBox)txt).Text = "吃饭";
}
}
private void button1_Click(object sender, EventArgs e)
{
card m = new card();
shitang s = new shitang(m);
m.yanzheng("123", textBox1);
}