VB.NET 函数返回 [英] VB.NET Function Return

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

问题描述

为了从 VB.NET 函数返回一个值,可以为函数名称"赋值或使用返回值".

In order to return a value from a VB.NET function one can assign a value to the "Functions Name" or use "return value."

我有时会看到这些混合在同一个函数中.就个人而言,我更喜欢回报.

I sometimes see these inter-mixed in the same function. Personally, I prefer the return.

我的问题是,两者之间的内部差异是什么(如果有的话)?

My question is, what is the internal difference, if any, between the two?

推荐答案

可能没有区别.IIRC,编译器生成的 IL 将它们都转换为 Return 语句除非额外使用 _returnValue 变量.

There is probably no difference. IIRC, the compiler generated IL converts them both into Return statements unless there is additional usage of a _returnValue variable.

在我看来,FunctionName 赋值的可读性很差,是 VB6 不良习惯的一个例子.我也更喜欢 _returnValue (NOT RETVAL) 变量方法.

The readability of the FunctionName assignment is poor in my opinion, and an example of a bad VB6 habit. I prefer the _returnValue (NOT RETVAL) variable method also.

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

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