我有串类反思与扩展方法
public static bool Contains(this string original, string value, StringComparison comparisionType)
{
return original.IndexOf(value, comparisionType) >= 0;
}
但不可能扩展方法通过反射来获取的方法
IEnumerable<MethodInfo> foundMethods = from q in typeof(string).GetMethods()
where q.Name == "Contains"
select q;
foundMethods仅获得包含(string)方法,为什么?其他包含方法在哪里?
[C#反射来标识扩展方法(可能重复http://stackoverflow.com/questions/299515/c-sharp-reflection-to-identify -extension-methods) – 2011-12-19 14:09:16
[Reflection to Identify Extension Methods]的可能重复(http://stackoverflow.com/questions/299515/reflection-to-identify-extension-methods) – 2017-04-13 14:35:00