这个错误是因为在ExcelImporter类中存在多个名为"Import"的方法。Ambiguous match found错误表示在调用GetMethod("Import")时,发现了多个匹配的方法,无法确定要获取哪个方法。

要解决这个问题,可以使用更详细的方法签名来获取正确的方法。例如,如果"Import"方法有特定的参数列表,可以使用GetMethod("Import", new Type[] { typeof(ParameterType1), typeof(ParameterType2), ... })来获取方法。

如果ExcelImporter类中确实存在多个名为"Import"的方法且参数列表相同,那么需要通过其他方式来区分这些方法,例如使用GetMethod("Import", BindingFlags)中的BindingFlags参数来指定获取的方法的修饰符。

IImporter importer = new ExcelImporter; MethodInfo importMethod = importerGetTypeGetMethodImport; 运行GetMethodImport报错了:Ambiguous match found

原文地址: https://www.cveoy.top/t/topic/iqin 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录