A set of technologies in .NET for building web applications and web services. Miscellaneous topics that do not fit into specific categories.
Hi @zal wel ,
Thanks for reaching out.
In your example:
HtmlButton bt = new HtmlButton();
bt = new HtmlButton();
What happens is that the first HtmlButton object is created and assigned to bt. Then, on the next line, bt is reassigned to a new HtmlButton instance.
Assuming no other references to the first object exist, it is no longer accessible in your code after the reassignment. At that point, it becomes eligible for garbage collection.
The .NET garbage collector will clean it up at a later time, based on its own internal scheduling, rather than immediately when the reference is lost.
Hope this helps! If my answer was helpful, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.