This project is read-only.

Need to query any IList that impl's INotifyCollectionChanged

Nov 26, 2008 at 1:56 PM
I am using my own collections (really C5 collections) that I have adapted to implement INotifyCollectionChanged. and I want to CLINQ it. I have mod'd my own version CLINQ and for obvious reasons I would rateher just use CLINQ.

Can this be added to the basic extension methods ?

Mod'ing the 2 branch would be ideal - please :)
Feb 4, 2009 at 11:18 PM
What would be most effective here would be a class in CLINQ that can take any generic IEnumerable that implements INotifyCollectionChanged and turn it into one of its own ReadOnlyContinuousCollections.

Now, there is a class in the source called PassThroughReadOnlyContinuousCollection that seems to get close to this concept, but the class is marked internal. And even then, the biggest hurdle to this idea is the IList<T> requirement placed on the ReadOnlyContinuousCollection, as opposed to accepting anything that is at least IEnumerable<T>. Since the System.Core assembly is required to make this project work, the normal System.Linq.Enumerable functions can be used to implement some of the basic IList<T> methods, like Contains and the indexer (using ElementAt).

And if that doesn't work, it shouldn't be much trouble to implement runtime type checking using reflection to discover if a collection passed in is an IEnumerable<T>, an ICollection<T> or an IList<T>. CLINQ could then implement the IList<T> functions based on what functions are already available in the source.

(By the way, I wish C5 would use INotifyCollectionChanged now since we have .NET 3.5. It's *so* useful...)
Mar 13, 2009 at 6:34 PM
This is a good idea, and will cut down on the ridiculous amount of extension methods that we have to define/repeat.  The best route is probably to go off IList<T> as we only work with indexed collections.  (Some kind of ObservableDictionary would be nice someday too.)  It would be a runtime check, which isn't the end of the world. 

I'll add this today if I can, and thanks for the suggestion.
Mar 18, 2009 at 7:36 PM
Actually this can cause some problems.  If there is a file that contains standard linq queries on things like List<T>, then those queries will be turned into clinq queries, or there will be ambiguity. This is going to require more thought unfortunately.
Mar 18, 2009 at 7:44 PM
You might just have to dispense with the extension syntax and call the System.Linq.Enumerable methods like any other normal static method when you need them. Then it only comes down to excluding "using System.Linq" statements. Ambiguities solved.
Jul 24, 2009 at 3:29 PM

I'm interested in the same functionality.  I would even be happy if ReadOnlyContinuousCollection was an interface.  Or rather, extract an interface from that class and add the extension method support for it.  I've made some progress in this direction in my own copy of ContinuousLinq.  I'd be happy to contribute back to the project.