byval仍允许进行更改 [英] byval still allows changes to be made

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

问题描述






我将结构传递给子程序,其中传递的参数已经被声明为ByVal的



但是,对子程序内部传递的变量进行的更改将流向已经传递的实际变量,即使使用

ByVal这不应该发生。


有没有人发现这个或我做错了什么/

误解了ByVal?


Richard


Hi,

I am passing a structure to a subroutine where the passed parameter has been
declared as ByVal.

However, changes made to the passed variable inside the subroutine flow
through to the actual variable that has been passed over, even though with
ByVal this should not happen.

Has anybody else discovered this or am I doing completely wrong /
misunderstanding the ByVal?

Richard

推荐答案



道歉,这是一个CLASS而不是一个结构我过去了。仍然 -

VB .NET不应该改变它,如果它已经作为ByVal传递,是吗?


Richard


理查德 < RA ******* @ hotmail.com>在留言中写道

news:c5 *********** @ otis.netspace.net.au ...

My apologies, it is a CLASS not a structure that I am passing over. Still -
VB .NET should not change it if it has been passed over as ByVal, true?

Richard

"Richard" <ra*******@hotmail.com> wrote in message
news:c5***********@otis.netspace.net.au...



我正在将一个结构传递给子程序,其中传递的参数已将
声明为ByVal。

然而,对子程序流程中传递的变量进行了更改
通过已经传递的实际变量,即使使用了ByVal,也不应该发生这种情况。

有没有人发现过这个或者我做错了什么/
Richard

Hi,

I am passing a structure to a subroutine where the passed parameter has been declared as ByVal.

However, changes made to the passed variable inside the subroutine flow
through to the actual variable that has been passed over, even though with
ByVal this should not happen.

Has anybody else discovered this or am I doing completely wrong /
misunderstanding the ByVal?

Richard





我的道歉,它是一个CLASS而不是我要经过的结构。仍然 -

VB .NET不应该改变它,如果它已经作为ByVal传递,是吗?


Richard


理查德 < RA ******* @ hotmail.com>在留言中写道

news:c5 *********** @ otis.netspace.net.au ...

My apologies, it is a CLASS not a structure that I am passing over. Still -
VB .NET should not change it if it has been passed over as ByVal, true?

Richard

"Richard" <ra*******@hotmail.com> wrote in message
news:c5***********@otis.netspace.net.au...



我正在将一个结构传递给子程序,其中传递的参数已将
声明为ByVal。

然而,对子程序流程中传递的变量进行了更改
通过已经传递的实际变量,即使使用了ByVal,也不应该发生这种情况。

有没有人发现过这个或者我做错了什么/
Richard

Hi,

I am passing a structure to a subroutine where the passed parameter has been declared as ByVal.

However, changes made to the passed variable inside the subroutine flow
through to the actual variable that has been passed over, even though with
ByVal this should not happen.

Has anybody else discovered this or am I doing completely wrong /
misunderstanding the ByVal?

Richard



嗨理查德,


在VB.net中,byval传递来自对象的引用值和值的

值。


我希望这有帮助吗? br />

Cor

Hi Richard,

In VB.net byval passes the value from the reference from an object and the
value from a value.

I hope this helps?

Cor


这篇关于byval仍允许进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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