views:

72

answers:

1

In C# I would simply do this:

myIEnumerable.Where(i=>i.ReturnsABool()).any();

How would I do that in VB.net? I'm stuck on how to formulate the lambda..

+3  A: 

Try this

myIEnumerable.Where(Function (i) i.ReturnsABool()).Any()
JaredPar
I see. Quite a bit more verbose. I start to see why the VB code I received isn't very fond of Lambdas :S
borisCallens
I don't like the VB syntax for lambdas very much either but that shouldn't stop anybody from using them, they are very useful.
Meta-Knight
I know, I love them in C#. It's sad that VB seems to discourager its use..
borisCallens
Until recently I thought Lambdas were not supported as many tools said they weren't but was sure they were, only saw the syntax recently on how to use these in VB myself. They are very useful for inline event handling etc.
RoguePlanetoid