If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using RSS
Are you aware of any information about the more subtle changes between beta1 and beta2
<br>
<br>I just noticed that Items, of now ObjectModel.Collection<T> is a List but it no longer supports Sort using the default comparer.
<br>MyCollection : Collection<ComparableObject>
<br>{
<br> public void Sort()
<br> {
<br> base.Items.Sort();
<br> }
<br>}
<br>what do you think the best technique to replace this with would be in this scenario ?
Using Power Collections, you could just write:
<br> Algorithms.SortInPlace(base.Items);
<br>With just the .NET Framework, you'd have to copy the list to an array, sort the array, and copy back. Something like (untested code ahead):
<br> T[] temp = new T[base.Items.Count];
<br> base.Items.CopyTo(temp, 0);
<br> temp.Sort();
<br> for (int i = 0; i < temp.Length; ++i)
<br> base.Items[i] = temp[i];
It turns out that even though items object of Collection<T> is now an exposed as an IList it still does infact use the List<T> object (makes sence) to back up the collection,
<br>in short you can still do sorting in place with just the frame work alone.
<br>((List<[MYTYPE]>)base.Items).Sort()
<br>I just took a stab in the dark prayed and it worked, who knows for how long. :) The joys of beta programing.
<br>Thanks for taking the time to write back.
<br>Adam Rogas
When will a new version of the Power Collections be released for beta 2? :)