Convert code line to VB

S

shapper

Hello,

Could someone, please, convert the following code line to VB.NET?

bool containsValue = myList.Any(item => item.NameParameter ==
nameParameterValue);

(This is .NET 3.5. I couldn't find a converter that does this)

Thanks,
Miguel
 
J

Jack Jackson

Hello,

Could someone, please, convert the following code line to VB.NET?

bool containsValue = myList.Any(item => item.NameParameter ==
nameParameterValue);

(This is .NET 3.5. I couldn't find a converter that does this)

Thanks,
Miguel

The => introduces a Lambda expression. I don't hve VB2008 installed
right now so I can't verify this, but I think it is:

Dim containsValue as Boolean = myList.Any( Function(item)
item.NameParameter = nameParameterValue )
 
J

Jay B. Harlow [MVP - Outlook]

Miquel,
Jack's answer:

Dim containsValue As Boolean = myList.Any(Function(item)
item.NameParameter = nameParameterValue)

Is correct for the RTM version of VS 2008.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top