methodinvocations.vb

来自「大名鼎鼎的mono是.NET平台的跨平台(支持linux」· VB 代码 · 共 55 行

VB
55
字号
Imports SystemImports System.CollectionsImports System.ReflectionNamespace MethodInvocations    Class Test        Function A1() As Integer            Return 1        End Function        Function A1(ByVal p1 As Integer) As Integer            Return 2        End Function        Function A1(ByVal ParamArray ps() As Integer) As Integer            Return 3        End Function        Function A1(ByVal p1 As String, Optional ByVal p2 As String = "", Optional ByVal p3 As Integer = 3, Optional ByVal p4 As Integer = 2) As Integer            Return 4        End Function        Function A() As Integer            Dim result As Boolean = True            result = a1() = 1 AndAlso result            result = a1(1) = 2 AndAlso result            result = a1(1, 2, 3) = 3 AndAlso result            result = a1(New Integer() {1}) = 3 AndAlso result            result = a1("") = 4 AndAlso result            result = a1("", "") = 4 AndAlso result            result = a1("", , 2) = 4 AndAlso result            result = a1("", "", , 2) = 4 AndAlso result            result = a1("", "", 2, 3) = 4 AndAlso result            If result Then                Return 0            Else                Return 1            End If        End Function        Shared Function Main() As Integer            Dim t As New Test            Dim result As Boolean = True            result = t.a = 0 AndAlso result            If result Then                Return 0            Else                Return 1            End If        End Function    End ClassEnd Namespace

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?