今天突然想到的一个问题,记录一下 namespace WpfApplication1 { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public delegate void SaySomething(string name, ref bool b); public event SaySomething come; public Window1() { InitializeComponent(); } public void msg(string s,ref bool b) { if (b) { MessageBox.Show("msg"); b = false; } } public void msg2(string s,ref bool b) { if (b) { MessageBox.Show("msg2"+s); } } public void msg3(string msgs, ref bool b, SaySomething say) { say(msgs, ref b); } private void Grid_Loaded(object sender, RoutedEventArgs e) { come += msg; come += msg2; bool k=true; //come("dffd",ref k); msg3("fsfdsfd", ref k, come); MessageBox.Show(k.ToString()); } } }