How to check if array is empty in VB.NET

2 Answers

0 votes
Module Module1

    Sub Main()

        Dim array() As Integer

        If array Is Nothing Then
            Console.WriteLine("array is not initialized")
        End If


    End Sub

End Module

' run:
' 
' array is not initialized

 



answered Aug 11, 2018 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim array(-1) As Integer

        If array.Length = 0 Then
            Console.WriteLine("array is empty")
        End If


    End Sub

End Module

' run:
' 
' array is empty

 



answered Aug 11, 2018 by avibootz
...