I want to conditionally unhook an event handler. Is this the right way to do it:
tb.TextChanged -= textBoxIntName_TextChanged;
?
This seems to be sensible, as hooking it up required:
tb.TextChanged += textBoxIntName_TextChanged;
…but it also seems that what corresponds to the “Delphi way” makes as much or more sense (but alas, it does not compile):
tb.TextChanged = nil;
You cannot assign events – only attach (+=) and remove (-=) operations are available for clients.
Read more about events here.
Also C# specification says: