错误:最佳重载方法匹配';LaunchPadLite.Software.Software(int,string,s

本文关键字:Software LaunchPadLite int string 重载 最佳 方法 错误 | 更新日期: 2023-09-27 18:28:00

每次我尝试运行时,都会在"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;
        }

错误:最佳重载方法匹配';LaunchPadLite.Software.Software(int,string,s

似乎方法签名是

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

然而,您正试图用调用它

string, int, string

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