none of these seem to do the trick:
var source = myViewModel.MyListCollectionView.Select(x => x as MyType);
var source = myViewModel.MyListCollectionView.Select<object, MyType>(x => x as MyType);
var source = myViewModel.MyListCollectionView.SourceCollection.Select<object, MyType>(x => x as MyType);
ahhhh found it. you have to use Cast<> first!
var source = myViewModel.MyListCollectionView.Cast<MyType>().Select(p=>p.MyProperty);
ListCollectionView
only implements the non-generic IEnumerable
interface. I suspect you want:
var source = myViewModel.MyListCollectionView.Cast<MyType>();
or (if some values won't be of MyType
, and that's okay):
var source = myViewModel.MyListCollectionView.OfType<MyType>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With