我有串類反思與擴展方法
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