×

VB.Net Programs

VB.Net program to demonstrate the Skip() LINQ extension method

By Nidhi Last Updated : November 13, 2024

VB.Net – Skip() LINQ Extension Method

In this program, we will use Skip() method. This method is used to return the collection after skipping the specified number of elements and print the result on the console screen.

Program/Source Code:

The source code to demonstrate the Skip() LINQ extension method is given below. The given program is compiled and executed successfully.

VB.Net code to demonstrate the example of Skip() LINQ extension method

'VB.NET program to demonstrate the 
'Skip() LINQ extension method.

Module Module1
    Sub Main()
        Dim intList = New List(Of Integer) From {101, 102, 103, 104, 105, 106}

        Dim result = intList.Skip(3)

        Console.WriteLine("Results:")
        For i = 0 To result.Count() - 1 Step 1
            Console.Write(result.ElementAt(i) & " ")
        Next
        Console.WriteLine()
    End Sub
End Module

Output

Results:
104 105 106
Press any key to continue . . .

Explanation

In the above program, we created a module Module1 that contains a Main() function. The Main() function is the entry point for the program.

In the Main() function, we created a list of integer elements, and then we skipped the first 3 elements from the list using Skip() method and then print the result on the console screen.

VB.Net LINQ Query Programs »


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.