[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

abcd

7/8/2008 3:55:00 PM

I have a list of Custom Objects. Those objects have inner objects. I want to
filter the list based on inner objects. Currently I am using

List.FindAll (SearchPredicate)

My SearchPredicate is a complex function. How LinQ is going to help me..will
that improve the performance than calling FindAll.

Any samples for performing filter. Basically, I want to fire one query and
that should return me list of select objects.

[Pardon me if this is not the right group to discuss this topic.]


1 Answer

Jeroen Mostert

7/8/2008 4:14:00 PM

0

abcd wrote:
> I have a list of Custom Objects. Those objects have inner objects. I want to
> filter the list based on inner objects. Currently I am using
>
> List.FindAll (SearchPredicate)
>
> My SearchPredicate is a complex function. How LinQ is going to help me..will
> that improve the performance than calling FindAll.
>
Probably not. LINQ isn't magic. Finding matching elements in an unsorted
collection is inherently an O(N) operation. If you want to improve that,
you'll need some sort of sorting (pardon the expression).

In general, LINQ will not improve the performance of anything (and there are
a few performance pitfalls to avoid, actually); it's a powerful and uniform
way of querying data over arbitrary providers. LINQ primarily offers
productivity benefits.

This is likely to change in the future, because LINQ queries do offer
opportunities for (transparent) optimization (parallelization in
particular). It's not the primary focus, though.

> Any samples for performing filter. Basically, I want to fire one query and
> that should return me list of select objects.
>
As for samples, you can't beat this: http://msdn.microsoft.com/vcshar...

--
J.