In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the problem of C# garbage collection". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the C# garbage collection problem.
Here is the issue of C# garbage collection:
C # garbage collection is part of the .NET runtime. The garbage collector manages all managed objects, and all .NET languages that need managed data (including C #) are subject to the runtime's garbage collector. The C# garbage collector can determine the time to run garbage collection and automatically carry out C# garbage collection. However, one of the products of garbage collection is that there is no deterministic destruction of C# objects. Therefore, the object child has been destroyed, but it is not null, and an ObjectDisposedException exception is generated during access.
Method 1:
Modify the constructor of a sub-form
PublicChildForm () {/ /. This.Disposed+=newSystem.EventHandler (Form_Disposed)} / / then the handler function privatevoidForm_Disposed (objectsender,EventArgse) {Child=null;} of the event Form_Disposed
Method 2:
Override the OnClosed method of ChildForm
ProtectedvoidOnClosed (EventArgse) {base.OnClosed (e); child=null;} at this point, I believe you have a deeper understanding of "how to solve the C# garbage collection problem". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.