public static Cloud UseHook <TAVObject>(this Cloud cloud, EngineHookType hookType, EngineObjectHookDelegate <TAVObject> hookDelegate) where TAVObject : AVObject { var className = AVObject.GetSubClassName <TAVObject>(); return(cloud.UseHook(className, hookType, (EngineObjectHookContext context) => { return hookDelegate(context.TheObject as TAVObject); })); }