He must ask you if you need that paper, right? If you do not need that, then he can throw that to the garbage bin. How will he determine if something is garbage or not? Say, he found a piece of paper on the ground. He is picking up all unnecessary items and throwing in the garbage. Say, someone has come to your room to clean. The confusion comes from a C# += syntax of the event handler, and that's what I will explain. The basic idea is straightforward and easy to understand. We need to come up with some clear understanding of this fuss and develop an easy rule of thumbs that we can always remember when coding. That's the place things get confusing for many new developers. Okay, how to determine when not to worry and when to worry? I did not say 'Never.' I said, 'Not always.' That means, yes, you should also know when you need to worry about event handlers and associated memory leaks. btnSayHello.Click += btnSayHello_Click īut, do you need to be feared about it? And do you always need to detach the event handler like: btnSayHello.Click -= btnSayHello_Click At some places, the idea of memory leak became so scary that some developers get paranoid about any event handler code they see like this one. There is a lot of fear among many new developers about C# memory leak caused by event handlers.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |