⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmfalsepositives.vb

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 VB
字号:
Public Class frmFalsePositives

  Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
    Dim i As Int32
    Dim b As Boolean = True
    Try
      i = Int32.MaxValue
      i += 1
    Catch ex As Exception When b = False
      MsgBox("caught")
      Return
    End Try

    MsgBox("not caught")
  End Sub

  Public Sub FalsePositive1()
    Dim s As String
    s = s & "why?" ' WARNING ?! - it is a valid statement
  End Sub
  Public Sub FalsePositive2()
    Dim o As Collection

    ' some other code here

    If o Is Nothing Then  ' WARNING ?! - just checking if it is null
      o = New Collection()
    End If
  End Sub

  Public Sub FalsePositive3()
    Dim s As Object
    Me.ReturnsValueByRef(s) ' WARNING ?! - I don't want to initialise s. The function will
  End Sub

  Public Function MaybeReturnNothingOrSomething() As Collection
    Return Nothing
  End Function

  ' if only VB had "out" like C# has
  Private Function ReturnsValueByRef(ByRef theMethodAssignsThis As Object) As Boolean
    theMethodAssignsThis = "some value to return"
    Return True
  End Function
End Class

⌨️ 快捷键说明

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