Sort an array of structures in .NET

前端 未结 7 1233
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 07:02

This is one of those times when only the hive mind can help - no amount of Google-fu can!

I have an array of structures:

Structure stCar 
    Dim Nam         


        
7条回答
  •  感动是毒
    2020-12-16 07:31

    Assuming that the structure has a property called MPH:

    cars = cars.OrderBy(Function(c) c.MPH)
    

    Note: the above code was auto-converted from the following c# code (in case it contains errors):

    cars = cars.OrderBy(c => c.MPH);
    

提交回复
热议问题