i wonder if anyone can help...
i have an abstract class called "Message" that impliment's icompareable
on the property "TimeSent".
i have two types of messages that inherit the "Message" class - Timed
Messages and Questions.
i get some of both and put them into an array list and then use the
Sort method. I need it to sort them by TimeSent regardless of type but
it groups them into questions and timedmessages. i could have sworn i
got this working at one point or maybe i just wished i had.
i thought that since they both inherit "Message" and "Message"
imliements icompareable it would sort them all as messages. the code
i'm using in "Message" is:
public int CompareTo(object obj)
{
if(obj is Message)
{
Message temp = (Message) obj;
return timeSent.CompareTo(temp.TimeSent);
}
else
{
return 0;
}
}
if anyone can help me with this i'd be grateful. cheers!