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

I’m writing every article I think will help you in some way. in that respect VB.Net program to demonstrate the OfType() LINQ extension method This article will be very useful for you.

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

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

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

Imports System
Imports System.IO
Imports System.Linq

Module Module1
    Sub Main()
        Dim lst As New ArrayList()

        lst.Add(101)
        lst.Add("India")
        lst.Add("USA")
        lst.Add(201)

        Dim Result = lst.OfType(Of String)()

        Console.WriteLine("Result: ")
        For Each str As String In Result
            Console.WriteLine(vbTab & str)
        Next
    End Sub
End Module
Result:
        India
        USA
Press any key to continue . . .

Final Words

VB.Net program to demonstrate the OfType() LINQ extension method Thank you for reading this useful article. Also, let us know if you have any doubts about this article. We are committed to helping you.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment