private MethodInfo GetMethod (Type t, string name, ref MethodInfo cached) {
if (cached == null) {
cached = t.GetMethod (name, BindingFlags.Static|BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
if (cached == null)
throw new Exception ("Method not found: " + name);
}
return cached;
}