protected virtual Type CreateNativeDelegateType(Type returnType, Type[] arguments, out bool isInRegistry, out Func <object, object[], object> caller) { isInRegistry = false; StaticDelegateCallback staticDelegate; if (StaticDelegateRegistry.TryFind(returnType, arguments, out staticDelegate)) { isInRegistry = true; caller = staticDelegate.Caller; return(staticDelegate.DelegateType); } else { // Else we try to do it with a dynamic call var type = DelegateHelper.NewDelegateType(returnType, arguments); caller = StaticDynamicDelegateCaller; return(type); } }
protected virtual Type CreateNativeDelegateType(Type returnType, Type[] arguments, out bool isInRegistry, out Func <object, object[], object> caller) { isInRegistry = false; StaticDelegateCallback staticDelegate; if (StaticDelegateRegistry.TryFind(returnType, arguments, out staticDelegate)) { isInRegistry = true; caller = staticDelegate.Caller; return(staticDelegate.DelegateType); } else { #if BURST_TESTS_ONLY // Else we try to do it with a dynamic call var type = DelegateHelper.NewDelegateType(returnType, arguments); caller = StaticDynamicDelegateCaller; return(type); #else throw new Exception("Couldn't find delegate in static registry and not able to use a dynamic call."); #endif } }