0

I have a list item(myList) on the Zedgraph,

PointPairList myList = new PointPairList();

myList has some values in it, now I want to copy just the y values alone into a new array.

My Trails:

myList.toArray(); // Seems to return a complete set of pointpair list
myList.GetRange(); // Gets a range of pointPair list

I'm looking to find a way, to copy just the y Data.

Thanks in advance....:)

SanVEE
  • 2,009
  • 5
  • 34
  • 55

2 Answers2

3

Use

double[] yvalues = myList.Select(p => p.Y).ToArray();

For this you need to include System.Linq namespace this way

using System.Linq;
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
3

You can use Select to get only the Y coordinate.

var result = myList.Select(pointPair => pointPair.Y).ToArray();
Mark Byers
  • 811,555
  • 193
  • 1,581
  • 1,452
  • +1 for the solution & as both the answers are same(Nikhil),Sorry that I can only be able accept one answer. – SanVEE Aug 03 '12 at 13:15