C9cf0e1fbe4bba7c355dc0e9c8cf02c6
41.Skip

LINQ Skip 简介

跳过序列中指定数量的元素,然后返回剩余的元素。

LINQ Skip 代码示例

/****************************************************************************
 * http://sikiedu.com liangxie
 ****************************************************************************/

using System.Linq;
using UnityEngine;

namespace UniRxLesson
{
    public class LINQSkipExample : MonoBehaviour
    {
        private void Start()
        {
            int[] grades = {59, 82, 70, 56, 92, 98, 85};

            var lowerGrades =
                grades.OrderByDescending(g => g).Skip(3);

            foreach (var grade in lowerGrades)
            {
                Debug.Log(grade);
            }
        }
    }
}

输出结果为

82
70
59
56
top Created with Sketch.