Results 1 to 3 of 3

Thread: Sorting a custom collection

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Sorting a custom collection

    How is it possible to sort a custom strongly typed collection by a specific field of an object?

    so I have a collection which is of type "Article"

    I now want to add article objects to this collection BUT when it adds the item, I want to sort the collection by a specific field on the article (in this case, for example the ID field of type integer)

    any ideas?

    I am implementing the IComparable and overriding the CompareTo but doesnt seem to fire it. Also... inheriting from Collection<T>
    Last edited by Techno; Jan 9th, 2009 at 12:28 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width