This project is read-only.

Suggestion - Remove or Relocate extension methods that operate on ObservableCollection

Oct 5, 2010 at 6:01 PM

I would like to suggest that the extension methods which extend ObservableCollection, could be removed or relocated to a separate namespace. This would allow me to have continuous linq based statements in the same class as BCL System.Linq queries. As it stands, I'm not sure how to do this. Once I add "using ContinuousLinq", all of my queries go through the Clinq extensions.

Sometimes, I don't want things going through Clinq. One example is when an expression includes a lambda delegate. In this case, Clinq throws an exception indicating that it doesn't support lambdas.

The AsReadOnly extension method could provide the "opt in", allowing me to control which queries should be continuous and which should be standard queries.

If the ObservableCollection extensions were removed, then users would need to add AsReadonly() to a query to get it to use CLINQ. If the extensions were moved to a separate namespace, then the user could still get the "automatic" behavior by including another using statement like "using ContinuousLinq.Auto" or something like that.

Are there downsides or dangers to such a change? Maybe I'm missing something that resulted in the current design decisions.

Thanks.

Oct 26, 2010 at 6:49 PM

One of the things I do is just cast your ObservableCollection to an IList<T>.

var collection = new ObservableCollection<string>();
...
var find = ((IList<string>)collection).Where(o => o.BeginsWith("Hello")).OrderBy(o => o);

Oct 26, 2010 at 7:24 PM
Thanks. That's a nice option. I'll give it a try.




From: "ismell" <notifications@codeplex.com>
Sent: Tuesday, October 26, 2010 1:50 PM
To: nathan@alner.net
Subject: Re: Suggestion - Remove or Relocate extension methods that operate on ObservableCollection [clinq:229692]


From: ismell

One of the things I do is just cast your ObservableCollection to an IList<T>.

var collection = new ObservableCollection<string>();
...
var find = ((IList<string>)collection).Where(o => o.BeginsWith("Hello")).OrderBy(o => o);

Read the full discussion online.

To add a post to this discussion, reply to this email (clinq@discussions.codeplex.com)

To start a new discussion for this project, email clinq@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Feb 22, 2011 at 9:28 AM

To me the cleanest option is not adding "using ContinuousLinq" and use it explicitly where you need it:

public ContinuousLinq.ReadOnlyContinuousCollection<foo> foos;