此代码是什么意思? [英] what this code means?

查看:168
本文介绍了此代码是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected override void Dispose(bool disposing)
       {
           if (disposing && (components != null))
           {
               components.Dispose();
           }
           base.Dispose(disposing);
       }

推荐答案

"

使用此方法可以关闭或释放由实现此接口的类的实例持有的非托管资源,例如文件,流和句柄.按照惯例,此方法用于与释放对象所拥有的资源或准备对象以供重用相关的所有任务.

http://www.hitxp.com/comp/pro/cs/220705.htm [ ^ ]

请参阅该链接

这将有助于
,

Use this method to close or release unmanaged resources such as files, streams, and handles held by an instance of the class that implements this interface. By convention, this method is used for all tasks associated with freeing resources held by an object, or preparing an object for reuse.

http://www.hitxp.com/comp/pro/cs/220705.htm[^]

refer that link

this will help


处置已使用的资源.它从内存中释放资源.阅读以下内容.

Tull Clancey 指出可能还需要清理其他对象.他写道:

...文件句柄,数据库控件,数据库对象,记录集对象,表单和任何其他活动链接应在Form_Unload(x)过程中关闭.如果未完成,则在应用程序结束时进行的任何链接仍然有效.

数据控件并非总是如此,但是关闭已打开的内容始终是一种好习惯.妈妈总是说要把昨天的玩具拿走,然后再和今天的玩具一起玩,很好建议!
很棒的一点!在担心表单关闭问题时,请不要忘记基础知识.
Clickety [ ^ ]
Disposing the used resources. It frees the resources from memory. Read the below one.

Tull Clancey Points out that other objects may need to be cleaned up as well. He writes:

...file handles, database controls, database objects, recordset objects, forms, and any other active links should be closed within a Form_Unload(x) procedure. If not done any links made will still be valid when the application is ended.

This is not always the case for the data control, however it is always good practice to close what you have opened. Mother always said put yesterdays toys away before playing with those today, very good advise!

An excellent point! While worrying about form closing problems, one shouldn''t forget the basics.
Clickety[^]


完全使用Dispose方法

使用此方法可以关闭或释放由类的实例持有的非托管资源,例如文件,流和句柄

此链接将为您提供帮助:)

何时,如何,何时何地使用Dispose [ ^ ]
Exact use of Dispose methord

Use this method to close or release unmanaged resources such as files, streams, and handles held by an instance of the class

this link will help you :)

When, How, Where and Why to use Dispose[^]


这篇关于此代码是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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