> On Jan 4, 2008 10:36 PM, Michael Hutchinson <[EMAIL PROTECTED]> wrote:
> > AFAIK you'd have to iterate it (though ForEach will simplify this). Of
> > course, that's what a Contains () call would do anyway -- if you want
> > O(1) contains calls, you'd need a hashtable, but a list obviously
> > needs... a list.
> Yes, that's the problem. It would be O(n) for a naïve approach.

I've made a, probably rather crude, solution by extending ListStore.  I
had hoped to just override AppendValues but those methods aren't
virtual.  So I went with the keep-an-index approach.

http://consonance.googlecode.com/svn/trunk/Whitemice.ZOGI.Gtk/General/Lists/EntityStore.cs

Comments welcome.

> Another option (besides hashtables, trees, etc) would be to store an
> additional field on each entity stating that it was already included
> or not, but of course this depends on how your code works, as it may
> be not possible.

An object can appear in perhaps dozens of lists, so that wouldn't really
work.


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to