Re: Efficiency of linq expression
Paul Cowan <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
Not to mention the last method I posted was wrong.
Here is the updated version:
public override List<Callee> CalleesForInitialSend()
{
var mobile = new List<Callee>(Callees.Where(x => (x is
MobileVoiceCallee)));
var landLine = new List<Callee>(Callees.Where(x => (x is
LandLineVoiceCallee)));
var union = new List<Callee>();
union.AddRange(mobile);
union.AddRange(landLine);
mobile.Join
(
landLine,
mob => mob.Contact.Uid,
land => land.Contact.Uid,
(m, l) => l
)
.ForEach(x => union.Remove(x));
return union;
}
2009/1/11 Paul Cowan <[email protected]>
> Hi,
>
> I have the following method that needs to run as fast as possible (don't
> they all).
>
> I hope it is obvious that I want all mobile users and all landline users
> who are not in the mobile list.
>
> I sincerelly doubt this is as efficient as it could be.
>
> Maybe somebody can point out a faster way of doing this:
>
> public override List<Callee> CalleesForInitialSend()
> {
> var mobile = new List<Callee>(Callees.Where(x => (x is
> MobileVoiceCallee)));
> var landLine = new List<Callee>(Callees.Where(x => (x is
> LandLineVoiceCallee)));
>
> mobile.Join
> (
> landLine,
> mob => mob.Contact.Uid,
> land => land.Contact.Uid,
> (m, l) => l
> )
> .ForEach(x => mobile.Remove(x));
>
> return mobile;
> }
>
>
>
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives