代码之家  ›  专栏  ›  技术社区  ›  eugeneK

ASP.NET VB中的内联调试

  •  0
  • eugeneK  · 技术社区  · 15 年前

    我有一个VB.NET应用程序,它几乎没有需要调试的函数(如C中的断言)。有可能吗?我怎么做?

        Public Shared Function createNumberArrayList(ByVal startValue As Integer, _
                                                 ByVal endValue As Integer, _
                                                 Optional ByVal isBackwards As Boolean = False) As ArrayList
        Dim nArrayList As New ArrayList()
        If Not isBackwards Then
            For index As Integer = startValue To endValue
                nArrayList.Add(index)
            Next
        Else
            For index As Integer = endValue To startValue
                nArrayList.Add(index)
            Next
        End If
        Return nArrayList
    End Function
    

    基本上,我需要输入一些值,看看函数是否工作并返回正确的数组列表。

    谢谢

    1 回复  |  直到 15 年前
        1
  •  1
  •   Meta-Knight    15 年前

    断言不是特定于C的,它是一个框架方法,因此可以在任何.NET语言中使用。你可以这样做:

    Diagnostics.Debug.Assert(nArrayList.Count > 0)
    

    编辑:

    我不确定debug.assert是否在ASP.NET应用程序中工作,我在网上发现了关于这个的矛盾信息…如果不起作用, check out this CodeProject article .