Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

WPF ObservableCollection implementation details

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 jwezorek   Members   

2636
Like
0Likes
Like

Posted 18 January 2013 - 12:15 PM

Are ObservableCollections in WPF implemented as linked lists or as arrays?

Basically, is random access into an ObservableCollection constant time?

(Yes, I've googled; can find no discussion of this anywhere. I need to maintain an ObservableCollection in sorted order and am trying to figure out if it is worth it to do a binary search)


Edited by jwezorek, 18 January 2013 - 02:34 PM.


#2 jwezorek   Members   

2636
Like
0Likes
Like

Posted 18 January 2013 - 12:50 PM

Nevermind ... found the answer here.

 

It's backed by a dynamic array. So O(1) random access lookups and amoritized O(1)  inserts at the end. Regular inserts are O(n).


Edited by jwezorek, 18 January 2013 - 02:33 PM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.