asp.net中finalize方法的用途是什么? [英] what is the use of finalize method in asp.net?

查看:56
本文介绍了asp.net中finalize方法的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



谁能知道这个...

简单示例...在ASP.NET中使用finalize方法有什么用?...



Can anyone know this...

what is the use of finalize method in asp.net?with simple example...

推荐答案

finalize 方法是一种C#方法,其作用类似于C方法.
但是,用户无法控制何时实际执行此方法.

此博客文章 [ .NET中的垃圾收集-深入了解初学者 [
The finalize method is a C# method which acts like the destructor in a C method.
However, a user does not have control on when this method would actually execute.

This blog post[^] is fairly useful in understanding this method.

Garbage Collection in .NET - A deeper look for the beginners[^] is a good article to go through for garbage collection.


finalize方法用于执行以下操作:

释放代码中使用的所有第三方对象
关闭在您的代码中打开的所有文件处理程序
非托管资源使用的可用内存
关闭您的代码中已打开的数据库连接
关闭代码中未打开的网络端口

请查看以下链接以获取示例和更多详细信息:

http://www.dotnet-guide.com/what-is-the-importance-of-finalize-method-in-net.html [
finalize method is used to perform the following:

Free any third party objects used in your code
Close any file handlers that are opened in your code
Free memory used by unmanaged resources
Close the database connection that is already opened in your code
Close the network port that is left open in your code

check the following link for example and more details:

http://www.dotnet-guide.com/what-is-the-importance-of-finalize-method-in-net.html[^]


这篇关于asp.net中finalize方法的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆