Toon posts:

[c#] CompareTo methode word niet gebruikt

Pagina: 1
Acties:
  • 36 views sinds 30-01-2008

Verwijderd

Topicstarter
Ik heb een generic List van AbstractServices (List<AbstractService>) die ik wil sorteren op basis van van een string-value. Daartoe heb ik IComparable<T> geimplementeerd voor de AbstractService klasse:

C#:
1
2
3
4
5
6
7
8
9
class AbstractService : AbstractDomainObject, IComparable<AbstractService>
{
   // *knip*

  public int CompareTo(AbstractService other)
  {
    return Category.Name.CompareTo(other.Category.Name); 
  }
}


Wanneer ik nu echter op mijn list de Sort() methode aanroep gebeurt er niets, terwijl dat volgens MSDN wel het geval zou moeten zijn (http://msdn2.microsoft.co...sh2ey19(en-us,vs.80).aspx, zie tweede bullet bij remarks)?

Wat doe ik fout?
edit:
laat maar, fout bleek heeeel ergens anders te zitten :D

[ Voor 35% gewijzigd door Verwijderd op 20-03-2006 19:41 ]


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 22-01 23:51

NMe

Quia Ego Sic Dico.

Dicht op verzoek.

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.