【问题标题】:Error: The best overloaded method match for 'LaunchPadLite.Software.Software(int, string, string)' has some invalid arguments错误:“LaunchPadLite.Software.Software(int, string, string)”的最佳重载方法匹配有一些无效参数
【发布时间】:2014-10-28 04:15:56
【问题描述】:

每次我尝试运行时,红色下划线“new Software(name, ID, newPath);”有人知道怎么修这个东西吗?

 public Software addSoftware()
        {
            Console.WriteLine("Enter the name of the application");
            string name = Console.ReadLine();
            Console.WriteLine("Enter the ID");
            int ID = Convert.ToInt32(Console.ReadKey());
            Console.WriteLine("Enter the full path");
            string newPath = Console.ReadLine();
            Software newSoftware = new Software(name, ID, newPath);
            return newSoftware;
        }

【问题讨论】:

  • 检查参数的顺序,第一个参数应该是int,第二个参数是一个字符串。

标签: c#


【解决方案1】:

好像方法签名是

LaunchPadLite.Software.Software(int, string, string)

但是你试图调用它

string, int, string

检查参数的顺序,传递正确的类型,它应该可以工作。

【讨论】:

    猜你喜欢
    • 2014-04-10
    • 1970-01-01
    • 2013-12-30
    • 1970-01-01
    • 2022-01-08
    • 2015-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多