I don't know if it's just too late or what, but I don't see how to do this...
What I'm expecting to do, and what the object browser says is there, is this:
var oc = new ObservableCollection<T>( new List<T>() );
But ObservableCollection<T>
has a single parameterless constructor. The object browser says there is 2 overloads where List and IEnuerable should be able to be passed in.
Is there something wrong with my setup? Are the constructors not on the phone version? (that would be strange)
If this really doesn't exist, what is the standard way of doing this with WP7 now?
In short, to convert an ArrayList to Object array you should: Create a new ArrayList. Populate the arrayList with elements, using add(E e ) API method of ArrayList. Use toArray() API method of ArrayList.
ObservableCollection has several constructors which have input parameter of List<T> or IEnumerable<T>:List<T> list = new List<T>();
ObservableCollection<T> collection = new ObservableCollection<T>(list);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With