How to use ienumerable and linq where condition to filter a list in VB.NET

1 Answer

0 votes
Imports System
Imports System.Linq
Imports System.Collections.Generic

Public Class Program
	Public Shared Sub Main()
        Dim list As List(Of String) = New List(Of String) From {
            "vb",
            "c",
            "java",
            "python",
            "c++",
            "go",
            "php"
        }
        Dim query As IEnumerable(Of String) = list.Where(Function(str) str.Length < 3)

        For Each s As String In query
            Console.WriteLine(s)
        Next
    End Sub
End Class


	
	
	
' run:
'
' vb
' c
' go
'

 



answered Aug 19, 2023 by avibootz
...