处理方法 [英] Dispose method

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

问题描述

如果我有2个变量,A和B,引用相同的对象,然后做一个

A.Dispose(),B会发生什么?

If I have 2 variables, A and B, referencing the same object and then do a
A.Dispose(), what happens to B?

推荐答案

大家好。


看完之后,我会更好地说明。


我有一个控制对象。它以2种模式运行:


A.它可以显示自己。显示器由一个控制显示器处理

经理。


B.它可以在不显示的情况下使用。


现在,我感到困惑的情况如下:


A.我实例化这样的对象。

B.我把它交给控制经理显示。

C.当用户完成后,控制管理器(保持对栈中控件的引用)将处理其副本。

D.但是,首先实例化控件的类

想要保持对象存在以供额外参考。


什么在控制管理器处理

的版本之后会发生原始对象吗?


Thanx,

Bill
Hi y''all.

After looking in to this, I better elaborate.

I have a control object. It operates it 2 modes:

A. It can display itself. The display handled by a control display
manager.

B. It can be utilized without being displayed.

Now, the situation I am confused about is as follows:

A. I instantiate such a object.
B. I give it to the control manager to display.
C. When the user is done, the control manager (which keeps a reference to
the control in a stack) disposes of its copy.
D. However, the class that instantiated the control in the first place
wants to keep the object present for additional reference.

What happens to the original object after the control manager disposes of
its version?

Thanx,
Bill


另一个添加。


当控制管理器从其堆栈弹出一个控件时,它会对

进行处理那个参考。


现在,如果相反,它只是弹出参考e没有进行处置

然后用另一个控件写了堆栈条目,是否已经取消引用了超过

的条目。


ie


堆栈控制A在索引0

堆栈控制B在索引1

堆栈控制C在索引2

弹出索引2 - 实际上,什么都不做,hust减少到堆栈指针的顶部。

堆栈控制D在索引2


C是否被认为不再被引用或是处置权限?
Another add on.

When the control manager pops a control from its stack, it does a dispose on
that reference.

Now, if instead, it simply popped the reference without doing the dispose
and then over wrote the stack entry with another control, does the over
written entry get dereferenced.

ie

Stack control A at index 0
Stack control B at index 1
Stack control C at index 2
Pop index 2 - actually, do nothing, hust decrement to top of stack pointer.
Stack control D at index 2

Is C recognized as no longer being referenced or is a dispose manditory?


web1110写道:
web1110 wrote:
你好你们全部。

看完之后,我会更好地阐述。

我有一个控制对象。它以2种模式运行:

A.它可以显示自己。显示器由一个控制显示器处理。

B.它可以在不显示的情况下使用。

现在,我困惑的情况如下:

A.我实例化这样一个对象。
B.我把它交给控制管理员显示。


这似乎是关键点。


您是否为对象或对象本身提供了引用(句柄)?


C.当用户完成后,控制管理器(保持对堆栈中控件的引用)处理其副本。
D.但是,首先实例化控件的类想要保持对象存在以供额外参考。

控制管理器处理后原始对象会发生什么?
它的版本?

Thanx,
比尔
Hi y''all.

After looking in to this, I better elaborate.

I have a control object. It operates it 2 modes:

A. It can display itself. The display handled by a control display
manager.

B. It can be utilized without being displayed.

Now, the situation I am confused about is as follows:

A. I instantiate such a object.
B. I give it to the control manager to display.
This would seem to be the critical point.

Are you giving it a reference (handle) to the object or the object itself?

C. When the user is done, the control manager (which keeps a reference to
the control in a stack) disposes of its copy.
D. However, the class that instantiated the control in the first place
wants to keep the object present for additional reference.

What happens to the original object after the control manager disposes of
its version?

Thanx,
Bill



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

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