c# 自定义事件,实现变量的值改变后就触发该事件
public delegate void delegateHandler(); public class my { public int i=0; public delegateHandler myhandle; public int changeI { get{return i;} set{ i=value; myhandle(); } } } public class otherclass { public my o; public otherclass() { o=new my(); } pulic void init() { o.myhandle+=new delegateHandler(howtodeal); } public void howtodeal() { //你自己的处理程序 } }
本文来自博客园,作者:NLazyo,转载请注明原文链接:https://www.cnblogs.com/bile/archive/2013/01/24/2875037.html