using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
class Reflection
{
public static MethodInfo FindMethodWithOneParameterOfType(Type typeToSearch, Type paramType)
{
MethodInfo method = null;
var t = typeToSearch;
while (t != null && method == null)
{
var methods = from m in t.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
where
m.GetParameters().Length == 1
&& m.GetParameters().First().ParameterType.Equals(paramType)
select m;
method = methods.FirstOrDefault();
t = t.BaseType;
}
return method;
}
}