Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom sorting algorithm
Message
From
04/05/2008 05:03:45
 
 
To
04/05/2008 02:34:32
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01315003
Message ID:
01315005
Views:
16
>Hi,
>I have item as below:
>
>
>ItemName          BeforeItem    AfterItem
>------------------------------------------
>"First"
>"Second"
>"Third"
>"B4Second"        "Second"
>"BetweenSecond"   "Second"      "B4Second"
>
>
>
>I would like to implement IComparable to sort them so that it could be as below:
>
>First
>B4Second
>BetweenSecond
>Second
>Third
>
>Please advice

Don't see how you can use IComparable for this since CompareTo() has to provide a decision based solely on the value of two items and you're structure precludes that. Maybe iterate over the items and insert each into an ArrayList or similar?

Regards,
Viv
Previous
Reply
Map
View

Click here to load this message in the networking platform