Jump to content

  • Log In with Google      Sign In   
  • Create Account

WPF ObservableCollection implementation details


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   Crossbones+   -  Reputation: 1856

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.


Sponsor:

#2 jwezorek   Crossbones+   -  Reputation: 1856

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.



PARTNERS