一、Skip()跳过

  static void Main(string[] args)
{
//skip()跳过
int[] nums = { ,,,,,,,,,};
//跳过3条
nums.Skip().ToList().ForEach(i=>Console.WriteLine(i));
}

Linq skip skipwhile take takewhile-LMLPHP

二、take()提取

  static void Main(string[] args)
{
//take()提取
int[] nums = { ,,,,,,,,,};
//提取3条
nums.Take().ToList().ForEach(i=>Console.WriteLine(i));
}

Linq skip skipwhile take takewhile-LMLPHP

三、takeWhile()条件为假结束匹配

     static void Main(string[] args)
{
//takewhile()条件匹配如果为假结束匹配
int[] nums = { ,,,,,,,,,};
//提取大于40的
nums.TakeWhile(i => i > ).ToList().ForEach(i=>Console.WriteLine(i));
}

Linq skip skipwhile take takewhile-LMLPHP

四、skipwhile()条件为假结束匹配

        static void Main(string[] args)
{
//skipwhile()条件匹配如果为假结束匹配
int[] nums = { ,,,,,,,,,};
//跳过40的
nums.SkipWhile(i => i > ).ToList().ForEach(i=>Console.WriteLine(i));
}

Linq skip skipwhile take takewhile-LMLPHP

05-08 08:12