Sort list by field (C#)

后端 未结 8 1234
一向
一向 2021-01-01 09:09

I have class like:

class SortNode
{
    public Int32 m_valRating = 0;

    public SortNode(Int32 valRating)
    {
        this.m_valRating = valRating;
    }         


        
8条回答
  •  我在风中等你
    2021-01-01 09:59

    You can use Linq for basic sorts:

    refSortNodeList.OrderBy(n => n.m_valRating);
    

    If you need more complex sorting your will need to implement IComparable to use the built in sorting.

提交回复
热议问题