![](/img/trans.png)
[英]what is the equivalent of as Object,.Factory, byVal in vb.net to c#?
[英]Using ByVal in vb.net methods, what's the common practice?
在vb.net中,默認情況下方法使用ByVal的參數,使其明確是更好的實踐/常規做法?
例如:
使用ByVal:
Private Sub MySub(ByVal Q As String)
{
' ...
}
End Sub
沒有ByVal:
Private Sub MySub(Q As String)
{
' ...
}
End Sub
通常的做法是可以在ByValue或ByReference中指定方法參數。 在VB.NET中,默認參數類型是ByVal
。 在許多編程語言中,方法參數默認為by-value
。 如果參數未使用ByVal
或ByRef
限定,則參數類型將為ByVal。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.