How to create a list of lists in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic
				
Public Module Module1
	Public Sub Main()
		Dim list_list As List(Of List(Of String)) = New List(Of List(Of String))()
		
        list_list.Add(New List(Of String) From {
            "a",
            "b",
            "c"
        })
        list_list.Add(New List(Of String) From {
            "c#",
            "c++",
            "c",
            "java"
        })
        list_list.Add(New List(Of String) From {
            "php",
            "python"
        })

        For Each subList As List(Of String) In list_list
            For Each item As String In subList
                Console.WriteLine(item)
            Next
            Console.WriteLine()
        Next
	End Sub
End Module




' run:
'
' a
' b
' c
' 
' c#
' c++
' c
' java
' 
' php
' python
' 

 



answered Mar 10, 2021 by avibootz
...