private static void GetMethodOptions(Type targetType, bool targetIsInstance, Type delegateType, ref MethodInfo[] methodOptions, ref string[] methodOptionNames) { if (targetType == null) { ArrayPool <MethodInfo> .ToZeroSizeArray(ref methodOptions); ArrayPool <string> .ToZeroSizeArray(ref methodOptionNames); return; } Type delegateReturnType; ParameterInfo[] delegateParameters; DelegateUtility.GetDelegateInfo(delegateType, out delegateReturnType, out delegateParameters); var bindingFlags = targetIsInstance ? BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic : BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; methodOptions = targetType.GetMethods(bindingFlags); int methodCount = methodOptions.Length; var validMethods = ReusedMethodsList; for (int n = methodCount - 1; n >= 0; n--) { var method = methodOptions[n]; if (method.MethodSignatureMatchesDelegate(delegateReturnType, delegateParameters)) { validMethods.Add(method); } } methodOptions = validMethods.ToArray(); validMethods.Clear(); methodCount = methodOptions.Length; ArrayPool <string> .Resize(ref methodOptionNames, methodCount); for (int n = methodCount - 1; n >= 0; n--) { methodOptionNames[n] = methodOptions[n].Name; } #if DEV_MODE Debug.Log(StringUtils.ToString(targetType) + ".GetMethodOptions results (" + methodOptionNames.Length + "):\n" + StringUtils.ToString(methodOptionNames, "\n")); #endif }