VB.net Program to Demonstrate the Oftype() Linq Extension Method

You are currently viewing 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 . . .

Ranjith Kumar

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

Leave a Reply