Home All Groups Group Topic Archive Search About

Convert code line to VB

Author
26 Nov 2007 12:00 AM
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

Author
26 Nov 2007 1:13 AM
Jack Jackson
On Sun, 25 Nov 2007 16:00:26 -0800 (PST), shapper <mdmo***@gmail.com>
wrote:

>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 )
Are all your drivers up to date? click for free checkup

Author
26 Nov 2007 3:42 AM
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.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"shapper" <mdmo***@gmail.com> wrote in message
news:3e3ae102-3e42-4d51-8747-755aeab1d9a2@b15g2000hsa.googlegroups.com...
> 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

Bookmark and Share

Post Thread options