Like with initialization: We take like:
Dim a() as integer = {1,2,4,6}
And if i want to print the array list it will be 1 , 2 ,4,6 as output But how can i take any value i.e n value to print n values as output.
Seems to me your best bet will be to add n elements from the array to a second array and print that instead:
Dim a() as integer = {1, 2, 3, 4, 6}
Dim b as new list(of integer)
' Where n is the total number of elements you want to print.
For counter As integer = 0 To n
b.Add(a(counter))
Next
PrintItems(b)
I haven't worked in VB for nearly 10 years so apologies if my code isn't 100% correct.
for each v as Integer In a.Skip(1).Take(3) Console.WriteLine(v) next to print out elements from index 1 to 3. BTW, to initialize a List with the elements of a, just Dim b As New List(Of Integer)(a)
Dim n As Integer = 3followed byDim b() As Integer = a.Take(n).ToArray