日期:2014-05-18 浏览次数:20944 次
using System.Reflection;
public static class Utility
{
public static bool Exists(object instance, string funcname)
{
bool value = false;
if (instance == null)
{
throw new NullReferenceException();
}
MethodInfo method = instance.GetType().GetMethod(funcname, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
if (method != null)
{
value = true;
}
return value;
}
}