The System.Linq.Queryable
type has a method named Contains
with two overloads:
bool Contains<TSource>(this IQueryable<TSource>, TSource)
bool Contains<TSource>(this IQueryable<TSource>, TSource, IEqualityComparer<TSource>?)
I want to get the first overload, so I use the following code:
var queryableContainsMethod = typeof(Queryable).GetMethod(
nameof(Queryable.Contains),
new[] { typeof(IQueryable<T>), typeof(T), });
But this returns null
. Why?
NOTE: I am not asking how to get a reference to this method; I am asking why the code that I expect to give me said reference, does not.