List<Point> ListTest = new List<Point>();
            ListTest.Add(new Point(3, 2));
            ListTest.Add(new Point(3, 32));
            ListTest.Add(new Point(32, 12));
            ListTest.Add(new Point(22, 82));            int j = 2;
            var temp = ListTest.Select((p, index) => new
            {
                index,
                p
            }).Where(p => p.index == j || p.index == j - 1 || p.index == j + 1).Max(p => p.p.X);

解决方案 »

  1.   

                int index = Convert.ToInt32(txtTest.Text);
                List<Point> tmpList = ListTest.Where((p, i) => i >= index - 1 && i <= index + 1).ToList();
      

  2.   

    int start = 2, count = 3;
            ListTest.Skip(start - 1).Take(3).OrderByDescending(p => p.X).FirstOrDefault();
    随机存取是List的强项,何苦用linq
      

  3.   

    还有个取最大值
    用这个
    Point pl = ListTest.Where((point, i) => i >= index - 1 && i <= index + 1).OrderBy(x => x.X).Last();
      

  4.   

    skip和take是合理点,但是如果他搞个0或者0以下,你这个就不行了,一定会取前3个的。。