C# 以开头的表达式调用提供了含糊不清的匹配验证

C# 以开头的表达式调用提供了含糊不清的匹配验证,c#,linq,.net-core,C#,Linq,.net Core,我有以下代码: case "StartsWith": return Expression.AndAlso( Expression.Not(Expression.Call(typeof(string), (typeof(string).GetMethod("IsNullOrEmpty")).Name, null, member)), Expression.

我有以下代码:

        case "StartsWith":
                return Expression.AndAlso(
                        Expression.Not(Expression.Call(typeof(string), (typeof(string).GetMethod("IsNullOrEmpty")).Name, null, member)),
                        Expression.Call(Expression.Call(member, "ToLower", Type.EmptyTypes), startsWithMethod, constExpression));
然而,它不断抛出一个异常“AmbiguousMatch found”。是什么导致了这个错误?我正在调试应用程序,不知道如何使用表达式树


startsWith=>
private static MethodInfo startsWithMethod=typeof(string).GetMethod(“startsWith”,新类型[]{typeof(string)})

哪一行引发异常?我建议将
return
分解为多行,并使用变量赋值,以查看异常抛出的确切位置。我假设它不在
startsWithMethod
行中?
member
constExpression
的类型/值是什么?当我使用LINQPad和.Net Core 3.1.0尝试每段代码时,我无法复制异常。我应该公布完整的代码。事实上,这并不是来自张贴的那条线
private static MethodInfo containsMethod=typeof(string).GetMethod(“Contains”)这导致了一个错误。只需将类型添加到其中即可修复它。谢谢