Exemple #1
0
        internal object[] CheckArguments(object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
        {
            int num = (parameters != null) ? parameters.Length : 0;

            object[]        objArray         = new object[num];
            ParameterInfo[] parametersNoCopy = null;
            for (int i = 0; i < num; i++)
            {
                object            o      = parameters[i];
                RuntimeTypeHandle handle = sig.Arguments[i];
                if (o == Type.Missing)
                {
                    if (parametersNoCopy == null)
                    {
                        parametersNoCopy = this.GetParametersNoCopy();
                    }
                    if (parametersNoCopy[i].DefaultValue == DBNull.Value)
                    {
                        throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"), "parameters");
                    }
                    o = parametersNoCopy[i].DefaultValue;
                }
                if (handle.IsInstanceOfType(o))
                {
                    objArray[i] = o;
                }
                else
                {
                    objArray[i] = handle.GetRuntimeType().CheckValue(o, binder, culture, invokeAttr);
                }
            }
            return(objArray);
        }