Click here to Skip to main content
15,909,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day,
a mathematical or logical question rather than a direct coding one. How do I write an extract from a worksheet where points are stored but with an unknown number?

List<MapPoint> lineMapPoints = new List<MapPoint>() {  //At this point, write some clever positioning };


I do not know if I explained it enough, if there were any ambiguities feel free to ask me :)

Thank you all for any advice

Improve:
I would like to list all the points from the list, even if I don't know their number. For example pts[0] we know that is the first point
pts[numPts - 1] indicates last

But I don´t know how to write other points whether you need 30 or just 2 in between

What I have tried:

List<MapPoint> lineMapPoints = new List<MapPoint>() {  pts[numPts/2], pts[numPts - 1] , pts[0] };
I have tried this but it is seriously insufficient to solve :D

numpts= number of points int
pts= points

Improve: My solution contains only the first, last and half point (but this is insufficient)
Posted
Updated 5-Oct-21 0:18am
v2
Comments
OriginalGriff 5-Oct-21 5:53am    
Quote: "I do not know if I explained it enough"
Not even close.
I have no idea at all what you are trying to achieve, much less what you have tried and why it didn't work.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.

Use the "Improve question" widget to edit your question and provide better information.
dejf111 5-Oct-21 6:04am    
Better?

1 solution

If you want to add all points to your loop, you could just initialize your list and then add your points with AddRange. It would look something like this:
C#
List<MapPoint> lineMapPoints = new List<MapPoint>();
lineMapPoints.AddRange(pts);
 
Share this answer
 
Comments
dejf111 5-Oct-21 6:21am    
Yes that´s perfect!!! Thank you!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900