c#: assigning a .tsv file to a string[,] array -
i'm looking write .tsv file string[,] array using readalllines , subsequent loops i'm running lot of null exceptions , array bounds issues. reason i'm going route because other methods have proved complicated me resolve.
below code i'm working with:
string[] words; public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { words = system.io.file.readalllines(@"file.tsv"); int k = words.count(); string[] count = words[1].split(' '); int k2 = count.count(); string [,] wordsnew = new string[k, k2]; (int = 0; < k; i++) { string[] temp = words[i].split(' '); (int j = 0; j < k2; j++) { wordsnew[i, j] = temp[j]; } } } regardless of little changes make , how assign wordsnew, keep running either null exception or index out of bounds errors. see problems or have simpler solutions this?
i'm rather new c# , coding in general may have seen answer in post without realizing it. if that's case, link other relevant topics appreciated!