Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm working on a project which parse colomn from a csv file.

I store my datas like that :

csv file :

A1 ; A2 ; A3 ; A4;

B1 ; B2 ; B3 ; B4;

.. ; .. ; .. ; .. ;

My class :

C#
public class Restaurant
   {
       public double X1 { get; set; }
       public double X2{ get; set; }
       public double X3{ get; set; }
       public double X4{ get; set; }
   }

public class ORestaurant
   {
       public ObservableCollection<Restaurant> OCollection_Restaurant { get; set;
   }


After parsing, OCollection_Restaurant contains a lot of "restaurants".

I would like to sort them by a specific column ( so a specific attribute of restaurants)

I tried with this :

C#
public class ligne : IComparable<ligne>
    {
        public double nresto;
        public double Int_row;
        public ligne(double num_resto, double my_row)
        {
            nresto = num_resto;
            Int_row = my_row;
        }
        public double CompareTo(ligne other)
        {
            return nresto.CompareTo(other.nresto);
        }
    }


It works fine with Ints but not with Doubles.

I would like to do the same think.

Can you help me please?

Thanks !
Posted

1 solution

 
Share this answer
 
Comments
PGI-Services 9-Oct-13 17:18pm    
Thanks !
ridoy 10-Oct-13 13:03pm    
Glad to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900