SimpleArgBuilder produces the value produced by the user as the argument value. It also tracks information about the original parameter and is used to create extended methods for params arrays and param dictionary functions.
Inheritance: ArgBuilder
Esempio n. 1
0
        // This helper can produce a builder for types that are directly supported by Variant.
        private static SimpleArgBuilder GetSimpleArgBuilder(Type elementType, VarEnum elementVarEnum)
        {
            SimpleArgBuilder argBuilder;

            switch (elementVarEnum)
            {
            case VarEnum.VT_BSTR:
                argBuilder = new StringArgBuilder(elementType);
                break;

            case VarEnum.VT_BOOL:
                argBuilder = new BoolArgBuilder(elementType);
                break;

            case VarEnum.VT_DATE:
                argBuilder = new DateTimeArgBuilder(elementType);
                break;

            case VarEnum.VT_CY:
                argBuilder = new CurrencyArgBuilder(elementType);
                break;

            case VarEnum.VT_DISPATCH:
                argBuilder = new DispatchArgBuilder(elementType);
                break;

            case VarEnum.VT_UNKNOWN:
                argBuilder = new UnknownArgBuilder(elementType);
                break;

            case VarEnum.VT_VARIANT:
            case VarEnum.VT_ARRAY:
            case VarEnum.VT_RECORD:
                argBuilder = new VariantArgBuilder(elementType);
                break;

            case VarEnum.VT_ERROR:
                argBuilder = new ErrorArgBuilder(elementType);
                break;

            default:
                var marshalType = GetManagedMarshalType(elementVarEnum);
                if (elementType == marshalType)
                {
                    argBuilder = new SimpleArgBuilder(elementType);
                }
                else
                {
                    argBuilder = new ConvertArgBuilder(elementType, marshalType);
                }
                break;
            }

            return(argBuilder);
        }
Esempio n. 2
0
 internal ConversionArgBuilder(Type parameterType, SimpleArgBuilder innerBuilder)
 {
     _parameterType = parameterType;
     _innerBuilder = innerBuilder;
 }
 internal ConversionArgBuilder(Type parameterType, SimpleArgBuilder innerBuilder)
 {
     _parameterType = parameterType;
     _innerBuilder  = innerBuilder;
 }