1

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)
{...}
1
  • 1
    Parameters need to be in the right order, and you don't specify [,] after the variable name. So in other words: Ave(sr, marks); Commented Sep 10, 2015 at 2:55

1 Answer 1

2

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[,]);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.