I have a list of polylines(which i got by querying an access 2007 table) that holds the below values;
+----------+----------+----------+-------+
| ObjectID | VertexId | distance | angle |
+----------+----------+----------+-------+
| 1 | 0 | 10 | 45 |
| 1 | 1 | 10 | 44 |
| 1 | 2 | 20 | 60 |
| 2 | 0 | 5 | 35 |
| 2 | 1 | 6 | 35 |
| 2 | 2 | 4 | 56 |
| 2 | 3 | 12 | 45 |
| 3 | 0 | 20 | 30 |
| 3 | 1 | 10 | 12 |
+----------+----------+----------+-------+
As the ObjectId column shows, there are only three objects. I would like to convert items from above list to a class in below format..
Class Polyline
{
int ObjectID;
list<int> vertices;
list<double> distances;
list<double> angles;
}
so that i can hold a List of Polyline objects and loop over each unique polyline as below..
foreach(Polyline polyObj in Polylines)
{
//do something with the polyline object;
}
What is the best/fast way of doing this in C#? It smells Linq..i am a total newbie to linq although very eager to learn and use it..
Assuming your List of polyline is a
DataTablethat holds all values: