How to use the LIKE searching for List in LINQ?

Steven Young 261 Reputation points
2022-03-28T09:23:28.86+00:00

I want to use the LIKE to match the file extension name in the LINQ, e.g ~. .
The IncludedExts is a List Type.

But the line below is not right.
.Where((Function(n) IncludedExts.Any(AddressOf n.Name Like))

The line below is OK
.Where((Function(n) IncludedExts.Any(AddressOf n.Name Contains))

How to use the LIKE? thank you.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,174 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 117.9K Reputation points
    2022-03-28T09:38:02+00:00

    Try this:

    ā€ƒ.Where(Function(n) IncludedExts.Any(Function(x) n.Name Like x))

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.