SIMPLE Code Cleanup Using IDisposable | C#, DotNet

preview_player
Показать описание
In DotNet and C# IDisposable is primarily used to cleanup (unmanaged) resources like file handles but combined with the using statement it is also a great tool to define scopes of behavior in our code in a clean and readable way.

Source code used in this tutorial:
Рекомендации по теме
Комментарии
Автор

In 60 I really appreciate the idea of teaching as well. 👍

medrlayman
Автор

Great idea. Please show us more, about the event guard.

cloudless_mirror
Автор

Great video. I have seen this idea, of using "using" and IDisposable, and at the time didn't like the idea. However in your video, I think that using "Scope" as the name really helped understand the purpose of the function, and maybe also because I'm more used to "using" keyword, this seemed very readable to me.

Also, this idea gave me an idea I might use in work I'm doing now, maybe is this idea you mentioned about "event guard"? Idea I had is because I just had to fix a bug in case of user double clicking a button. Application is winforms, I used a boolean =true if click event is running, and at the end set it to false. So this prevents it from running more than once at the same time. I think I could use this method to make code cleaner.

The event guard you mention, has something to do about this?

MartinMensch
visit shbcf.ru