inN0Cent
inN0Cent

Reputation: 363

c# to vb.net Linq conversion

I am trying to convert this to vb.net via the developerfusion conversion tool but dosent work..

using System.Linq;

List<A> foo = GetFooList();    // gets data
List<A> fooBorItems = foo.Where(a = > a.FName == "foobar").ToList();

Plz can someone convert this to vb.net form e and tell me whats this --> =>

Upvotes: 0

Views: 79

Answers (3)

huMpty duMpty
huMpty duMpty

Reputation: 14470

Try

Dim fooBorItems as List(Of A) = foo.Where(Function(a) a.Name = "foobar").ToList()

Also please have a look at the article about linq samples

Upvotes: 1

Joel Etherton
Joel Etherton

Reputation: 37543

It's a predicate delegate used in an extension method. Here is the MSDN article that describes its usage:

http://msdn.microsoft.com/en-us/library/bfcke1bz.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2

The appropriate usage in VB for what you've pasted would be:

Dim fooBorItems as  List(Of A) = foo.Where(Function(x) x.FName = "foobar").ToList()

Upvotes: 2

Aron
Aron

Reputation: 15772

Dim foobar = foo.Where(function(x) x.name = "foo").ToList()

Upvotes: 1

Related Questions