public FunctionBinding Add(string functionName, Delegate functionDelegate)
        {
            if (functionName == null)
            {
                throw ExceptionBuilder.ArgumentNull("functionName");
            }

            if (functionDelegate == null)
            {
                throw ExceptionBuilder.ArgumentNull("functionDelegate");
            }

            // Check return type

            if (functionDelegate.Method.ReturnType == typeof(void))
            {
                throw ExceptionBuilder.FunctionMustNotBeVoid(functionDelegate);
            }

            // Check parameters

            ParameterInfo[] parameters = functionDelegate.Method.GetParameters();

            foreach (ParameterInfo param in parameters)
            {
                if (param.IsOut || param.ParameterType.IsByRef)
                {
                    throw ExceptionBuilder.FunctionMustNotHaveRefOrOutParams(functionDelegate, param);
                }

                if (param.IsOptional)
                {
                    throw ExceptionBuilder.FunctionMustNotHaveOptionalParams(functionDelegate, param);
                }

                if (param.ParameterType.IsArray)
                {
                    throw ExceptionBuilder.FunctionMustNotHaveArrayParams(functionDelegate, param);
                }
            }

            // Ok, everything seems to be fine.

            ReflectionFunctionBinding reflectionFunctionBinding = new ReflectionFunctionBinding(functionName, functionDelegate.Method, functionDelegate.Target, false);

            Add(reflectionFunctionBinding);
            return(reflectionFunctionBinding);
        }