Is someone able to help me out with the following please, I'm trying to split data from an input file (2 pieces of data per line, separated by either of the delimiters specified in the code below). To do this I have declared the string array 'split input', however when I run the program I get a runtime error (screenshot) with the split input line inside the while loop highlighted in yellow. I can't see what I am doing wrong, I'm copying sample code which seems to be working fine :( NB - the messageBox line below the yellow is just for my testing to prove the split worked
        private int DetermineArraySize(StreamReader inputFile)
    {
        int count = 0;
        while (!inputFile.EndOfStream)
        {
            inputFile.ReadLine();
            count++;
        }
        return count;
    }
    private void ReadIntoArray(StreamReader inputFile, string[] gameArray, int[] revArray)
    {
        string rawInput;
        string[] splitInput = new string[2];
        int count = 0;
        char[] delimiters = {'=', '@',};
        while (!inputFile.EndOfStream || count < gameArray.Length)
        {
            rawInput = inputFile.ReadLine();
            {
                splitInput = rawInput.Split(delimiters);
                MessageBox.Show(splitInput[0] + " // " + splitInput[1]);
                count++;
            }
        }
    }
    private void rdGameSalesForm_Load(object sender, EventArgs e)
    {
        StreamReader inputFile = File.OpenText("GameSales.txt");    //Open Input File
        int arraySize = DetermineArraySize(inputFile);              //Use input file to determine array size
        string[] gameTitle = new string[arraySize];                 //Declare array for GameTitle
        int[] revenue = new int[arraySize];                         ///Declare array for Revenue
        ReadIntoArray(inputFile, gameTitle, revenue);
Thanks for your help
 
     
    