问题描述
您好,
我正在开发一个从csv文件解析colomn的项目。
我存储我的数据:
csv文件:
A1; A2 ; A3; A4;
B1; B2; B3; B4;
..; ..; ..; ..;
我的班级:
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 :
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;
}
解析后,OCollection_Restaurant包含很多餐馆。
我想按特定列对它们进行排序(所以餐馆的特定属性)
我试过这个:
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 :
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);
}
}
它适用于Ints但不适用于双打。
我想做同样的想法。
你能帮我吗?
谢谢!
It works fine with Ints but not with Doubles.
I would like to do the same think.
Can you help me please?
Thanks !
推荐答案
这篇关于对双打的ObservableCollection进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!