Search code examples
c#visual-studio-2010formatexception

The best overloaded method match for 'int.Parse(string)' has some invalid arguments


    Console.WriteLine("Enter the page that you would like to set the bookmark on: ");
    SetBookmarkPage(int.Parse(Console.ReadLine));

It's the int.Parse(string) part that gives me the error message of the topic of this thread. Don't really understand what I should do, I'm parsing a string into an int and sending it with the SetBookmarkPage method, what am I missing? SetBookmarkPage looks like this and is contained in the same class:

private void SetBookmarkPage(int newBookmarkPage) {}


Solution

  • Change it to

    SetBookmarkPage(int.Parse(Console.ReadLine()));
    

    You were missing () after Console.ReadLine