日期:2014-05-17 浏览次数:21197 次
namespace BLL
{
public class Test
{
public delegate void RefreshDelegate(ref string msg);
public void Call(RefreshDelegate d)
{
string msg = string.Empty;
for (int i = 1; i <= 10; i++)
{
msg = string.Format("{0}\r\n", i);
d(ref msg);
}
}
}
}
namespace CSWin
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void btn_Test_Click(object sender, EventArgs e)
{
BLL.Test test = new BLL.Test();
BLL.Test.RefreshDelegate d = new BLL.Test.RefreshDelegate(Refresh);
test.Call(d);
}
private void Refresh(ref string msg)
{
this.textBox1.Text += msg;
}
}
}