maddddie123
maddddie123

Reputation: 185

passing array in different method

This is part of my code. I am getting the error "the best overloaded method match for has some invalid arguments" in my Ave method. I don't know what I am doing wrong. Thanks.

static void Main()
{

    string inFile="marks2D.txt";
    StreamReader sr=new StreamReader(inFile);

    int[,] marks= new int[5,6];
    for(int i=0; i<5; i++)
    {
        string line=sr.ReadLine();
        temp=line.Split(',');

        for(int j=0; j<6; j++)
        {
            marks[i,j]=int.Parse(temp[j]);
            Console.WriteLine("{0}", marks[i,j]);
        }
    }
    Ave(marks[,], sr);
}

static void Ave(StreamReader sue, int[,] temp)
{...}

Upvotes: 1

Views: 38

Answers (1)

Steve
Steve

Reputation: 9603

The parameters in the method call are in the wrong order, they need to match the order in the method declaration.

Try: Ave(sr, marks[,]);

Upvotes: 2

Related Questions