Sorting a list of <Object> with VB and LINQ

后端 未结 2 785
既然无缘
既然无缘 2021-02-20 16:23

I\'m trying out some LINQ expressions and can\'t get them to work with the List class. Basically I want to be able to sort a list of custom objects by property type, however t

相关标签:
2条回答
  • 2021-02-20 17:18
    Dim asc = From f In l Order By f.Position
    Dim desc = From f In l Order By f.Position Descending
    
    0 讨论(0)
  • 2021-02-20 17:23

    I used c# to VB converter..

    Dim sortedasc = l.OrderBy(Function(k) k.Position) 
    Dim sorteddesc = l.OrderByDescending(Function(k) k.Position)
    

    this should work..

    0 讨论(0)
提交回复
热议问题