Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LINQ to Objects Subquery ?
Message
From
04/09/2009 11:04:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/09/2009 23:32:06
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
VB 9.0
OS:
Vista
Miscellaneous
Thread ID:
01422566
Message ID:
01422676
Views:
39
>I am the newest of Linq newbies so feel free to speak slowly and use small words <bg>
>
>I have list of integers.
>
>I have a business object of strongly type properties.
>( the bo implements ienumerable through one of its own functions but if I can't get that to work I can convert the data to an array or some other object that implement the interface in a standard way. The bos also expose all standard ado properties re datatable, currentview etc if that helps)
>
>There are properties
>
>ikey,description, itemplateskey
>
>I want to select the bo.ikey where itemplateskey is not in the list of integers.
>
>(corallaries would includes selecting all records from one bo where some value in that bo is found or not found in some field in another bo )
>
>I think I've stripped down the problem to the essentials. Any help on linq subquery syntax with be appreciated as I think that is probably going to be the most elegant solution for a lot of this kind of stuff
>
>TIA

Viv already covered it really. I am only doing a second pass with small letters:)

IEnumerable, IQueryable,List,Array ... IOW anything that you can enumerate locally or remotely should remind you Linq:) So you don't need to get an array (Linq do that for you if you want with .ToArray() extension method).
//method syntax - richer
var query = boCollection.Where( bo => !intList.Contains( bo.itemplateskey ) ).Select( bo => bo.ikey );

// or - comprehension syntax

var query = from bo in boCollection
                 where !intList.Contains( bo.itemplateskey ) 
                 select bo.ikey;
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform