【发布时间】:2013-05-02 11:05:25
【问题描述】:
我知道VB 中的多个函数分配没有直接的方法,但有我的解决方案 - 好不好,你会如何做得更好?
我需要什么(我在python中如何做,只是一个例子)
def foo(a) ' function with multiple output
return int(a), int(a)+1
FloorOfA, CeilOfA = foo(a) 'now the assignment of results
我如何在 VB 中做到这一点:
Public Function foo(ByVal nA As Integer) As Integer() ' function with multiple output
Return {CInt(nA),CInt(nA)+1}
End Function
Dim Output As Integer() = foo(nA) 'now the assignment of results
Dim FloorOfA As Integer = Output(0)
Dim CeilOfA As Integer = Output(1)
【问题讨论】:
-
当
nA已经是Integer时,没有理由使用CInt(nA)。
标签: vb.net function variable-assignment mass-assignment