vendredi 26 avril 2019

C# Reflection typeof(string).GetMethod("Equals) Ambiguous match on netcoreapp2.2

Trying to get the methodInfo for

string.Equals(string a, string b, StringComparison comparer)

using the following method:

var methodInfo = typeof(string).GetMethod("Equals", new[] { typeof(string), typeof(string), typeof(StringComparison) } );

when running it on .netcoreapp2.2 i get

System.Reflection.AmbiguousMatchException: Ambiguous match found.

Looking at the overloads i cannot find anything matching the same signature.

When running in a project targeting 4.6.1 everything works fine

Question: How can I target the above stated method without being ambiguous?





Aucun commentaire:

Enregistrer un commentaire