views:

52

answers:

2

I'm wondering if there is a way to do this in bindable linq:

var LeftItems = AllItems.Where(p => !RightItems.Contains(p)));

I have tried liberal use of the AsBindable(), but it doesn't work for me..

var LeftItems = AllItems.AsBindable().Where(p => !RightItems.AsBindable.Contains(p)));

If this is not supported in BindableLINQ, is there a clever work around I'm not seeing or is there another similar package that does support it?

A: 

The .Where() method is the last one which is ran, so the result type of the .Where() extension method is the type leftItems will have. If you want the result as bindable, I think you should simply do:

var leftItems = AllItems.Where(p => !RightItems.Contains(p)).AsBindable();
Frans Bouma
A: 

I think you are looking for the Except method.

var LeftItems = AllItems.Except(RightItems);

Not sure if that is implemented in bindable linq.

Otherwise you should try Obtics.

Maarten