IDisposable的 [英] Idisposable

查看:102
本文介绍了IDisposable的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于实现IDisposable的VB.Net文档有:


受保护的可覆盖过载Sub Dispose(ByVal disposing As Boolean)

如果处置那么

''免费其他州(管理对象)。

结束如果

Tag.Dispose()

''免费赠送你自己的state(非托管对象)。

''将大字段设置为null。

结束Sub


我无法理解评论:

什么是状态(托管对象)意思是

什么是状态(非托管对象)意思是

我理解托管对象和非托管对象,比如com对象,某些

GDI对象是不受管理的,应该放在这里。但

" state"是什么意思?


-

丹尼斯在休斯顿

VB.Net Documentation for implementing IDisposable has:

Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
If disposing Then
'' Free other state (managed objects).
End If
Tag.Dispose()
'' Free your own state (unmanaged objects).
'' Set large fields to null.
End Sub

I am having trouble understanding the comments:
What does "state (managed objects)" mean
What does "state (unmanaged objects)" mean
I understand managed objects and unmanaged objects like com objects, certain
GDI objects are unmanaged and should be disposed here. But what does the
"state" mean?

--
Dennis in Houston

推荐答案

它只是意味着该对象将从其持有的任何资源中解脱出来,因​​此它将不再是有状态的。不要让措辞

挂起你。

" Dennis" <德**** @ discussions.microsoft.com>在留言中写道

news:76 ********************************** @ microsof t.com ...
It just means that the object would free itself from whatever resources it
was holding, thus it would no longer be statefull. Don''t let the wording
hang you up.
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
用于实现IDisposable的VB.Net文档具有:

受保护的可覆盖过载Sub Dispose(ByVal disposing As Boolean)
如果处置则Then < br'>''自由其他状态(托管对象)。
结束如果
Tag.Dispose()
''释放你自己的状态(非托管对象)。
''设置大字段为空。
结束子

我无法理解评论:
什么是状态(管理对象)是什么意思状态(非托管对象)是什么意思是我理解托管对象和非托管对象,比如com对象,某些GDI对象是不受管理的,应该放在这里。但是什么呢?状态是什么?是什么意思?

- 休斯顿的丹尼斯
VB.Net Documentation for implementing IDisposable has:

Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
If disposing Then
'' Free other state (managed objects).
End If
Tag.Dispose()
'' Free your own state (unmanaged objects).
'' Set large fields to null.
End Sub

I am having trouble understanding the comments:
What does "state (managed objects)" mean
What does "state (unmanaged objects)" mean
I understand managed objects and unmanaged objects like com objects,
certain
GDI objects are unmanaged and should be disposed here. But what does the
"state" mean?

--
Dennis in Houston



谢谢。我想状态只是意味着它的实例存在并且

托管对象将释放自己(有时),而我必须释放所有我自己的状态非托管对象GDI笔等等。


" Scott M."写道:
Thanks. I guess the State just means that the instance of it exists and the
managed objects will free themselves (sometime) whereas I have to free all my
own state unmanaged objects like the GDI pens, etc.

"Scott M." wrote:
它只是意味着该对象将从它所持有的任何资源中解脱出来,因​​此它将不再是有状态的。不要让措辞挂起你。

Dennis <德**** @ discussions.microsoft.com>在消息中写道
新闻:76 ********************************** @ microsof t.com。 ..
It just means that the object would free itself from whatever resources it
was holding, thus it would no longer be statefull. Don''t let the wording
hang you up.
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
VB.Net用于实现IDisposable的文档有:

受保护的可覆盖过载Sub Dispose(ByVal disposing As Boolean)
如果处置那么
' '释放其他状态(托管对象)。
结束如果
Tag.Dispose()
''释放你自己的状态(非托管对象)。
''将大字段设置为null 。
结束Sub

我无法理解这些评论:
状态(被管理对象)是什么是什么意思状态(非托管对象)是什么意思是我理解托管对象和非托管对象,比如com对象,某些GDI对象是不受管理的,应该放在这里。但是什么呢?状态是什么?是什么意思?

- 休斯顿丹尼斯
VB.Net Documentation for implementing IDisposable has:

Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
If disposing Then
'' Free other state (managed objects).
End If
Tag.Dispose()
'' Free your own state (unmanaged objects).
'' Set large fields to null.
End Sub

I am having trouble understanding the comments:
What does "state (managed objects)" mean
What does "state (unmanaged objects)" mean
I understand managed objects and unmanaged objects like com objects,
certain
GDI objects are unmanaged and should be disposed here. But what does the
"state" mean?

--
Dennis in Houston




Scott,它会如果你能给我一个例子,那将非常有帮助:


a状态管理对象和你自己的状态非托管对象。例如,

是GDI Pen状态管理对象。或者我自己的州管理对象


我真的很感谢你帮助我理解这一点。


Dennis"写道:
Scott, it would be very helpful if you could give me an example of :

a State Managed Object and a "your own State unmanaged object. For example,
is a GDI Pen "state managed object" or my own state managed object"

I really appreciate you helping me to understand this.

"Dennis" wrote:
VB.Net用于实现IDisposable的文档有:

受保护的可覆盖过载Sub Dispose(ByVal disposing As Boolean)
如果处理则Then < br'>''自由其他状态(托管对象)。
结束如果
Tag.Dispose()
''释放你自己的状态(非托管对象)。
''设置大字段为空。
结束子

我无法理解评论:
什么是状态(管理对象)是什么意思状态(非托管对象)是什么意思是我理解托管对象和非托管对象,比如com对象,某些GDI对象是不受管理的,应该放在这里。但是什么呢?状态是什么?是什么意思?

- 休斯顿的丹尼斯
VB.Net Documentation for implementing IDisposable has:

Protected Overridable Overloads Sub Dispose(ByVal disposing As Boolean)
If disposing Then
'' Free other state (managed objects).
End If
Tag.Dispose()
'' Free your own state (unmanaged objects).
'' Set large fields to null.
End Sub

I am having trouble understanding the comments:
What does "state (managed objects)" mean
What does "state (unmanaged objects)" mean
I understand managed objects and unmanaged objects like com objects, certain
GDI objects are unmanaged and should be disposed here. But what does the
"state" mean?

--
Dennis in Houston



这篇关于IDisposable的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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