c# - Check the eventhandler exist for particular event present in the object -


i have use following code snippet in loop

datatable childtable = datatable.dataset.relations[relationname].childtable;  if (childtable != null) {    ibindinglist = childtable.asdataview() ibindinglist;    ibindinglist.listchanged += new listchangedeventhandler(griddatarecord_listchanged); } 

in case need check listchanged event invoked ibindinglist object.can please , provide suggestion achieve this. in advcance.

regards, rajasekar

there no way see if handler has been added. luckily, not need to.

ibindinglist.listchanged -= griddatarecord_listchanged; ibindinglist.listchanged += griddatarecord_listchanged; 

assuming well-behaved class (and in case, should able trust class well-behaved), can safely remove griddatarecord_listchanged if has not been added. removing nothing. if ever add handler after removing it, never added multiple times.


Comments

Popular posts from this blog

Need help in packaging app using TideSDK on Windows -

java - Why does my date parsing return a weird date? -

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -