How to pop the first element of a list in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic

Class Program
	Public Shared Sub Main()
        Dim list As List(Of Integer) = New List(Of Integer) From {
            1,
            2,
            3,
            4,
            5
        }

        If list.Count > 0 Then
            list.RemoveAt(0)
        End If

        For Each num As Integer In list
            Console.Write(num & " ")
        Next
    End Sub
End Class


' run:
'
' 2 3 4 5 
'

 



answered May 2 by avibootz
...