在 vb.net 中,默认情况下,方法的参数使用 ByVal,将其明确化是更好的做法/常见做法吗?
例如:
使用 ByVal:
Private Sub MySub(ByVal Q As String)
{
' ...
}
End Sub
没有 ByVal:
Private Sub MySub(Q As String)
{
' ...
}
End Sub
最佳答案
根据 Microsoft :
It is good programming practice to include either the ByVal or ByRef keyword with every declared parameter.
如果你使用 Visual Studio,它默认插入
ByVal
如果您没有明确指定它。
关于vb.net - 在 vb.net 方法中使用 ByVal,通常的做法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7358601/