The following code shows you how to take elements from array to mentioned index. For example array contains {1,3,2,5,6} and you say just take first 3 elements {1,3,2} and rest are skipped then after applying LINQ Take() method you can do this. See the code below.
Dim numbers() As Integer = {59, 82, 70, 56, 92, 98, 85}
Dim query = numbers.Take(3)
For Each i In query
Console.Write(i.ToString() & " ")
Next
Output of the program is:
59 82 70 (taking first three elements starting from 0th index)
0 comments:
Post a Comment