How to a add of elements range from one list to another in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic
 
Public Class Program
    Public Shared Sub Main()
        Dim list1 = New List(Of String)() From {"vb.net", "c#", "java", "c", "c++", "python", "rust"}
        Dim list2 As New List(Of String)
 
        list2.AddRange(list1.GetRange(2, 3))
         
        For Each s As String In list2
            Console.WriteLine(s & " ")
        Next
    End Sub
End Class
 

 
 
' run:
'
' java 
' c 
' c++
'

 



answered Mar 8, 2023 by avibootz
edited Mar 8, 2023 by avibootz
...