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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -