ADVERTISEMENT
ADVERTISEMENT

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

Here, we are going to demonstrate the Skip() LINQ extension method in VB.Net.
Submitted by Nidhi, on February 02, 2021

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 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 »



ADVERTISEMENT




ADVERTISEMENT


Comments and Discussions!

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.