UnityEditor.AssetModificationProcessorInternal.CheckArgumentTypes C# (CSharp) Method

CheckArgumentTypes() private static method

private static CheckArgumentTypes ( Type types, MethodInfo method ) : bool
types System.Type
method System.Reflection.MethodInfo
return bool
        private static bool CheckArgumentTypes(Type[] types, MethodInfo method)
        {
            ParameterInfo[] parameters = method.GetParameters();
            if (types.Length != parameters.Length)
            {
                string[] textArray1 = new string[] { "Parameter count did not match. Expected: ", types.Length.ToString(), " Got: ", parameters.Length.ToString(), " in ", method.DeclaringType.ToString(), ".", method.Name };
                Debug.LogWarning(string.Concat(textArray1));
                return false;
            }
            int index = 0;
            foreach (Type type in types)
            {
                ParameterInfo info = parameters[index];
                if (type != info.ParameterType)
                {
                    Debug.LogWarning(string.Concat(new object[] { "Parameter type mismatch at parameter ", index, ". Expected: ", type.ToString(), " Got: ", info.ParameterType.ToString(), " in ", method.DeclaringType.ToString(), ".", method.Name }));
                    return false;
                }
                index++;
            }
            return true;
        }

Usage Example

示例#1
0
        private static bool CheckArgumentTypesAndReturnType(Type[] types, MethodInfo method, Type returnType)
        {
            bool result;

            if (returnType != method.ReturnType)
            {
                Debug.LogWarning(string.Concat(new string[]
                {
                    "Return type mismatch. Expected: ",
                    returnType.ToString(),
                    " Got: ",
                    method.ReturnType.ToString(),
                    " in ",
                    method.DeclaringType.ToString(),
                    ".",
                    method.Name
                }));
                result = false;
            }
            else
            {
                result = AssetModificationProcessorInternal.CheckArgumentTypes(types, method);
            }
            return(result);
        }
All Usage Examples Of UnityEditor.AssetModificationProcessorInternal::CheckArgumentTypes