Использование List.GetRange()
Imports System
Imports System.Collections.Generic
Sub Main()
' 0 1 2 3 4 5 6 7
Dim ListA As New List(Of String)(New String() {"a", "ab", "abc", "ba", "bac", "bdb", "cba", "zba"})
Dim ListB As New List(Of String)
ListB.AddRange(ListA.GetRange(3, 3))
For Each Str As String In ListB
Console.WriteLine(Str)
Next
Console.ReadLine()
End Sub
или вы можете использовать Linq
Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Module1
Sub Main()
' 0 1 2 3 4 5 6 7
Dim ListA As New List(Of String)(New String() {"a", "ab", "abc", "ba", "bac", "bdb", "cba", "zba"})
Dim ListB As New List(Of String)
ListB.AddRange(ListA.Where(Function(s) s.StartsWith("b")))
' This does the same thing as .Where()
' ListB.AddRange(ListA.FindAll(Function(s) s.StartsWith("b")))
For Each Str As String In ListB
Console.WriteLine(Str)
Next
Console.ReadLine()
End Sub
End Module
Результаты:
Поисковые ключи: '' .FindAll' и .CopyTo' – Muhammad