This project is read-only.

Choose when to use CLinq?

Aug 29, 2010 at 9:27 PM


I'm using clinq for syncing account lists.

When a new acc is added to the settings, it should show up in some comboboxes for selecting.

So for this, I made the itemssources of the collections to ReadOnlyContinuousCollections and I thought

that clinq just does linq's work if both are clinq-collections.

But when I try to do this:

return new XElement("Accounts", from acc in this
                                            select new XElement("Account",
                                                new XAttribute("Hoster", acc.Hoster),
                                                new XAttribute("Username", SecurityHelpers.Crypt(acc.Username)),
                                                new XAttribute("Password", SecurityHelpers.Crypt(acc.Password)),
                                                Utilities.SettingsToXml(acc.CustomSettings, "CustomSettings")));

I get the exception that clinq does not support expressions of type NewArrayInit

Is there any way to prevent clinq from becoming active here?

Aug 30, 2010 at 3:15 PM

From what I can see in the clinq library, the existence of the extention methods that act on ObservableCollection makes clinq methods active on all observables. If you add a using for clinq, then its extensions will take affect on standard ObservableCollections too.

I think I've run into your situation before and, in the end, I had to remove the usings for Clinq and then call the extension methods using conventional syntax. This isn't ideal, but it works. If there is an alternative, I'd be interested to hear it too.


// using ContinuousLinq;
using clinq = ContinuousLinq.ContinuousQueryExtension;
var result = clinq.Where(items, i => i.Description == "123");