G
Gary Nastrasio
I have an array of data and I would like to project every 3 elements
into a new data type.
For example, I have this array:
string[] myString = {"1.0", "2.0", "3.0", "7.0", "8.0", "9.0"};
I would like to project this data into a vertex struct:
struct Vertex
{
public Vertex(float a, float b, float c){x=a;y=b;z=c;}
float x, y, z;
};
Here's a for loop that will do it, but I'd like to figure it out with LINQ:
for(int i = 0 ; i < myString.Length ; i += 3)
Vertex v = new Vertex(myString, myString[i + 1], myString[i + 2]);
Thanks for any help.
into a new data type.
For example, I have this array:
string[] myString = {"1.0", "2.0", "3.0", "7.0", "8.0", "9.0"};
I would like to project this data into a vertex struct:
struct Vertex
{
public Vertex(float a, float b, float c){x=a;y=b;z=c;}
float x, y, z;
};
Here's a for loop that will do it, but I'd like to figure it out with LINQ:
for(int i = 0 ; i < myString.Length ; i += 3)
Vertex v = new Vertex(myString, myString[i + 1], myString[i + 2]);
Thanks for any help.