|
Assume that some data is stored in the file:
x = 0, y = 0, z = 0
x = 10, y = 0, z = 0
x = 20, y = 0, z = 0
x = 30, y = 0, z = 0
x = 40, y = 0, z = 0
x = 50, y = 0, z = 0
x = 60, y = 0, z = 0
x = 70, y = 0, z = 0
x = 80, y = 0, z = 0
x = 90, y = 0, z = 0
I need to read them line by line and store them in an array like this:
First define a structure:
struct Node
{
public int node_x;
public int node_y;
public int node_z;
}
public Node [] Nodelist = new Node [];
Then save the x, y, and z values in the file to node_x, node_y, and node_z in the NodeList. Which method is faster and better? The amount of data is about a few thousand lines. |
|