Type function(): Object[] does not support Slicing

I am loading text into an array from a text file. I know the array is being populated from when I debug the program, but when i attempt to output the information i get the error “Type function(): Object does not support Slicing.” How do i go about fixing this? I will post my code below

var returnChar = "

"[0];
var commaChar = “,”[0];

var dataLines = dataFile.text.Split(returnChar);
var buildDataPairs = new ArrayList();
 
for (var dataLine in dataLines) {
var dataPair = dataLine.Split(commaChar);
buildDataPairs.Add(dataPair);
}
var dataPairs = buildDataPairs.ToArray; 
Debug.Log(dataPairs[0][0]);

Don’t use ArrayList, it’s slow, untyped, and obsolete. (Don’t use the JS Array class either for the same reason.) Use generic Lists. Since buildDataPairs has no type, turning it into an array makes in an Object array, which you would need to cast in order to use.

Also you need to use ToArray() as a function, not ToArray. However, since you should make buildDataPairs into a List of String, there’s no real reason to turn it into an array, so you can just leave it as List.< String > and not bother with ToArray().