I want to take the contents of a text file and place it into a 2D array, character by character. I have included an example below
Text File
ABCDE
FGHIJ
KLMOP
2D Array (Char Array)
[
[A,B,C,D,E]
[F,G,H,I,J]
[K,L,M,O,P]
]
What would be the best way of going about this? For the time being I am assuming that the length of the text file is also the width (in Char), I will fix it up later!
OpenFileDialog openFile1 = new OpenFileDialog();
string sFileName = openFile1.FileName;
int lineCount = File.ReadLines(sFileName).Count();
char[,] letters = new char[lineCount,lineCount];