Help Converting C# linq to vb.net Linq

Hello all,

I’m relatively new to linq and have been searching different forums trying and find a way to solve this problem. I was able to piece together one from a couple searches and its working perfectly in a external c# test. Unfortunately though it was in c# not vb. Can anyone here help me convert this small snippet from c# to vb so that I can use it in an assign statement in my flow?

string result = names.First(x => x.Contains(search))

“search” is a specific string
“names” is a list of strings
“result” is the first match

The purpose of this linq is to find the first match in a list of strings that contains the string variable “search” and place the value of the full match into the “result”. Thank you all in advance for helping with this syntax!

Have you tested with:

result = names.First(Function(x) x.Contains(search))
1 Like

Thank you a bunch! I knew I must have been missing a small piece of syntax! I’ll keep this in mind when creating new linq statements.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.