HowToForums.net Forum Index HowToForums.net
An Open Source of Knowledge
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using the ICOMPARE

 
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion
View previous topic :: View next topic  
Author Message
sharonshmuelfeldman



Joined: 29 Jul 2009
Posts: 8

PostPosted: Wed Aug 05, 2009 5:32 pm    Post subject: using the ICOMPARE Reply with quote

//1) put :

public class Car : IComparable

//2) in Car Class put :
public int CompareTo(object obj)
{
if (obj is Car) {
return this.Year.CompareTo((obj as Car).Year); // compare user names
}
throw new ArgumentException("Object is not a Car");
}
//3 use in parkinglot (replace old sort) :

Array.Sort(cars,0, Num_of_cars-1);//array+index+length
________
Parkwood
Back to top
Display posts from previous:   
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group