-1

我很欣赏你关于如何在下一条指令的同一行上排序的指示。

非常感谢!

 this.ProductosUnicos = this.repository.TemperatureReports.AsEnumerable().Select(tt => tt.Producto).Distinct().ToList();


public List<String> ProductosUnicos
{
    get
    {
        return this._productosunicos;
    }
    private set
    {
        if (this._productosunicos == value)
            return;

        this._productosunicos = value;
        this.OnPropertyChanged("ProductosUnicos");
    }
}
4

1 回答 1

0

对于排序,有OrderByOrderByDescending扩展方法:

reports
    .Select(tt => tt.Producto)
    .Distinct()
    .OrderBy(p => p)
    .ToList();

期望一个表达式,该OrderBy表达式将为序列中的每个项目求值。结果序列将根据表达式的返回值进行排序。

于 2013-05-17T15:09:45.200 回答