private static void LoadFromMethods(Type type)
        {
            MethodInfo[] methods = type.GetMethods();

            foreach (MethodInfo method in methods)
            {
                MathFunctionAttribute mfatt = method.
                                              GetCustomAttribute <MathFunctionAttribute>();

                if (!method.IsStatic)
                {
                    continue;
                }

                if (mfatt == null)
                {
                    continue;
                }

                Delegate del = CreateDelegate(method);

                MathType ret = MathType.Boolean;
                try
                {
                    ret = method.ReturnType.ToMathType();
                }
                catch (ArgumentException)
                {
                    continue;
                }

                List <MathType> args    = new List <MathType>();
                bool            discard = false;
                foreach (ParameterInfo p in method.GetParameters())
                {
                    try
                    {
                        args.Add(p.ParameterType.ToMathType());
                    }
                    catch (ArgumentException)
                    {
                        discard = true;
                        break;
                    }
                }

                if (discard)
                {
                    Logger.Log(LogLevel.Warning, Logger.REGISTRY,
                               "Argument found to be invalid for method " + method.Name +
                               "(). Ignoring.");
                    continue;
                }

                FunctionInfo func = new FunctionInfo(del, ret, mfatt.Name, args.ToArray());

                Logger.Log(LogLevel.Debug, Logger.REGISTRY, "Registering function: " + func.Name);
                RegisterFunction(func);
            }
        }
        private static void LoadFromFields(Type type)
        {
            FieldInfo[] fields = type.GetFields();

            foreach (FieldInfo f in fields)
            {
                if (!f.IsStatic)
                {
                    continue;
                }

                MathFunctionAttribute mfatt = f.GetCustomAttribute <MathFunctionAttribute>();

                if (f.FieldType != typeof(FunctionInfo))
                {
                    Logger.Log(LogLevel.Warning, Logger.REGISTRY,
                               "MathFunctionAttribute applied to field that is " +
                               "not a FunctionInfo. Ignoring.");
                    continue;
                }

                FunctionInfo func = f.GetValue(null) as FunctionInfo;

                if (func == null)
                {
                    continue;
                }

                Logger.Log(LogLevel.Debug, Logger.REGISTRY, "Registering function: " + func.Name);
                RegisterFunction(func);
            }
        }
        private static void LoadFromProperties(Type type)
        {
            PropertyInfo[] properties = type.GetProperties();

            foreach (PropertyInfo prop in properties)
            {
                MathFunctionAttribute mfatt = prop.
                                              GetCustomAttribute <MathFunctionAttribute>();

                if (mfatt == null)
                {
                    continue;
                }

                if (prop.PropertyType != typeof(FunctionInfo))
                {
                    Logger.Log(LogLevel.Warning, Logger.REGISTRY,
                               "MathFunctionAttribute applied to property that is " +
                               "not a FunctionInfo. Ignoring.");
                    continue;
                }

                MethodInfo   getter = prop.GetGetMethod(true);
                FunctionInfo func   = getter.Invoke(null, new object[0]) as FunctionInfo;

                if (func == null)
                {
                    continue;
                }

                Logger.Log(LogLevel.Debug, Logger.REGISTRY, "Registering function: " + func.Name);
                RegisterFunction(func);
            }
        }