为什么这个子有效?为什么我可以将每个类型(String、Interface、Int)作为参数传递给 sub 而不会出现编译器错误
Why this sub is valid? Why i can pass each Type (String, Interface, Int) to a sub without compiler error as parameter
Public Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Me.x(1)
End Sub
Public Sub x(ByVal x As String)
MessageBox.Show(x)
End Sub
End Class
如果我想要 sub x 中的接口作为示例 Public sub x(Byval IPerson)
它也可以无错误地接受所有类型。
在 VS2013 中,Debug/Debugging/Projects 和 Solutions/VB 默认值是一个选项,可以将 Option Strict 打开。
Public Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Me.x(1)
End Sub
Public Sub x(ByVal x As String)
MessageBox.Show(x)
End Sub
End Class
如果我想要 sub x 中的接口作为示例 Public sub x(Byval IPerson)
它也可以无错误地接受所有类型。
在 VS2013 中,Debug/Debugging/Projects 和 Solutions/VB 默认值是一个选项,可以将 Option Strict 打开。