📌  相关文章
📜  unity 对列表进行排序 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:17.554000             🧑  作者: Mango

代码示例2
// listVariable = The list of objects/vars etc.
// 'delegate' command - aka callback
// a / b - the values to compare
// N.B. possible return values are 1, 0 and -1. The .compare method 
// can be used on multiple var types to ease sorting, e.g. int, float, string.
listVariable.Sort(delegate(ObjectType a, ObjectType b)
    {
        // E.g.
        return string.Compare(a.param, b.param);
    });