一个类中的ref变量 [英] ref variables in a class

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

问题描述




i使用VB.NET并定义了一个类,该类应该保存一个ref成员变量,以及

a同一类类型的实例。 $>

如果我定义了类类型的变量,然后为这个成员分配了一个实例/值

,它是否指向我分配给它的实例一份副本

的数据?

TIA,z。

Hi,

i use VB.NET and defined a class that should hold a ref member variables to
a instance of the same class type.

if i define the variable of the class type and then assigns a instance/value
to this member, will it point to the instance i assigned it to or to a copy
of the data?

TIA,z.

推荐答案

ZF,


要么使用byvalue或byref,要么只通过对象的地址将

通过。


我希望这有帮助,


Cor
Z F,

Either if you use byvalue or byref than only the address of the object will
be passed.

I hope this helps,

Cor


Cor,你的意思是,如果我有一个参考对象并通过它将byVal转换为

函数,然后在内存中生成完整的数据副本。例如


public class myclasstest

.....

结束课


在我的主程序中,

dim b as new myclasstest


调用myFunctiontest (byval b)


内存中是否有b的完整副本?

-

Dennis in Houston

" Cor Ligthert [MVP]"写道:
Cor, do you mean that if I have a reference object and pass it byVal to a
function then a complete copy of the data is made in memory..for example

public class myclasstest
.....
end class

in my main program,
dim b as new myclasstest

Call myFunctiontest(byval b)

Is a complete copy made of b in memory?
--
Dennis in Houston
"Cor Ligthert [MVP]" wrote:
ZF,

要么使用byvalue或byref,要么只传递对象的地址。

我希望这有帮助,

Z F,

Either if you use byvalue or byref than only the address of the object will
be passed.

I hope this helps,

Cor



不,指针的副本被制作在记忆中......

Dennis <德**** @ discussions.microsoft.com>在消息中写道

news:34 ********************************** @ microsof t.com ...
no, a copy of the pointer is made in memory....
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
Cor,你的意思是如果我有一个引用对象并将它传递给
函数,那么数据的完整副本将在内存中生成。例如

公共课myclasstest
....
结束课

在我的主程序中,
dim b as new myclasstest

调用myFunctiontest(byval b)

内存中是否有b的完整副本?
-
休斯顿的丹尼斯

Cor Ligthert [MVP]"写道:
Cor, do you mean that if I have a reference object and pass it byVal to a
function then a complete copy of the data is made in memory..for example

public class myclasstest
....
end class

in my main program,
dim b as new myclasstest

Call myFunctiontest(byval b)

Is a complete copy made of b in memory?
--
Dennis in Houston
"Cor Ligthert [MVP]" wrote:
ZF,

要么使用byvalue或byref,要么只传递对象的地址


我希望这会有所帮助,

Z F,

Either if you use byvalue or byref than only the address of the object
will
be passed.

I hope this helps,

Cor



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

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