LINQ way to populate a 2-D array from a text file
Found this cool method to populate a 2-D array while reading a file which contains a 2-D array split by comma – courtesy this post in stackoverflow.
A B C
D E F G
H I J
Note the array values of array and array are followed by a spaces. Your text file needs to have a space after C and J so that the below one liner statement can read it as a 4×4 matrix. I showed this for odd case scenario of a matrix in a text file
string array = File.ReadAllLines("file path").Select(s => s.Split(',')).ToArray();