Skip to content

Instantly share code, notes, and snippets.

@drub0y
Created August 29, 2012 23:41
Show Gist options
  • Save drub0y/3520487 to your computer and use it in GitHub Desktop.
Save drub0y/3520487 to your computer and use it in GitHub Desktop.
GetMethods WinRT
public static IEnumerable<MethodInfo> GetMethods(this Type type, string name)
{
return GetMethods(type.GetTypeInfo(), name);
}
public static IEnumerable<MethodInfo> GetMethods(this TypeInfo typeInfo, string name)
{
TypeInfo currentTypeInfo = typeInfo;
do
{
foreach (MethodInfo methodInfo in currentTypeInfo.GetDeclaredMethods(name))
{
yield return methodInfo;
}
currentTypeInfo = typeInfo.BaseType.GetTypeInfo();
} while (currentTypeInfo != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment