I have 4 .txt documents in a folder, each document with 10 lines of information. I want to save each line from each file in an array. I am looking for a solution that will give me:
//four arrays with 10 variables each
vFile_0[0-9]
vFile_1[0-9]
vFile_2[0-9]
vFile_3[0-9]
I could potentially accomplish this by naming each variable based on i within the loop:
for (int i = 0; i < vCount; i++)
{
string[] vFileLine_ + i = File.ReadAllLines("document_" + i + ".txt" );
}
This doesn't work, Does anyone know what I am to replace the i with?
EDIT: I am going into further detail. I want to organize Any Number of .txt documents in a folder, that have random amounts of lines inside them.
Example:
Document 1 has 6 lines of information.
Document 2 has 3 lines of information.
Document 3 has 12 lines of information.
Document 4 has 5 lines of information.
I wish to store all that info into arrays, and when done correctly, the variable names will be shown like so:
vFile_0 [5]
vFile_1 [2]
vFile_2 [11]
vFile_3 [4]
As you can see above, each document has a respective variable name with an array amount equal to the lines in that document, each variable in those arrays stores the line of info from that document as a string. The purpose of this type of variable storage is that I could one day run the program and detect 4 files that have 10 lines each, or 120,000 files with 30,000 lines each.
The only issue I am having right now, is naming the variables that way.