Subsonic collection.Find() using delegate broken - fixed
Technorati Tags: SubSonic
Simply put, with the update of SubSonic 2.1 (Beta), use of Find( delegate ) no longer works. The inheritance chain was changed to Collection<T> from List<T> for data binding objectives. No worries, the underlying collection is there for you! You can get List functionality from Ling extensions.
Code that was broken by the update:
Store.Image imageMoved = imageCollection.Find(delegate(Store.Image image) {
return image.ImageId == imageId;
});
Error 5 Cannot convert anonymous method to type ‘object’ because it is not a delegate type C:\…\Source\Web\admin\controls\product\images.ascx.cs 226 59 Web
The Find method is now replaced and we need to change the above to the following.
using System.Linq;
...
Store.Image imageMoved = imageCollection.ToList<Store.Image>().Find(delegate(Store.Image image) {
return image.ImageId == imageId;
});
November 26th, 2008 at 2:02 am
Thank you very much!