I'm looking to use the HTML Bridge to send data currently in an ObservableCollection to some JavaScript. I'm assuming that this data would need to be in an array, rather than in an ObservableCollection, for it to be usable in JavaScript. Note: This assumption may be incorrect.
Silverlight doesn't seem to have the ToArray() function on its ObservableCollection class, so I was wondering if there's a nicer way to convert it into an array than iterating over the whole thing.
Silverlight 3 & 4 have the ToArray extension method on any IEnumerable<T>
: http://msdn.microsoft.com/en-us/library/bb298736(VS.95).aspx, which an ObservableCollection<T>
is.
Make sure you have System.Core referenced and a using System.Linq;
at the top of your class.
Note: This should not be taking as confirmation that you have to turn it into an array to send it to Javascript. I don't know about that.
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