c# - How to remove the speech event handler? -


please have @ following code

speechrecognizer sr2 = new speechrecognizer(); 

...

sr2.speechrecognized += new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); 

...

void sr2_speechrecognized(object sender, speechrecognizedeventargs e){} 

in here first code shows initialization of speech recognizer, second code shows registering event handler , third code shows event handler.

now, need remove event handler. how can this? please help..

just use

  sr2.speechrecognized -= new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); 

since remove method uses delegate.equals check equality, don't need store new eventhandler<speechrecognizedeventargs>(sr2_speechrecognized); anywhere, , can make call above remove handler.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -