Exemple #1
0
        public void SetAsByrefVariantIndirect(ref Variant value)
        {
            Debug.Assert(IsEmpty); // The setter can only be called once as VariantClear might be needed otherwise
            Debug.Assert((value.VariantType & VarEnum.VT_BYREF) == 0, "double indirection");

            switch (value.VariantType)
            {
            case VarEnum.VT_EMPTY:
            case VarEnum.VT_NULL:
                // these cannot combine with VT_BYREF. Should try passing as a variant reference
                SetAsByrefVariant(ref value);
                return;

            case VarEnum.VT_RECORD:
                // VT_RECORD's are weird in that regardless of is the VT_BYREF flag is set or not
                // they have the same internal representation.
                _typeUnion._unionTypes._record = value._typeUnion._unionTypes._record;
                break;

            case VarEnum.VT_DECIMAL:
                _typeUnion._unionTypes._byref = UnsafeMethods.ConvertDecimalByrefToPtr(ref value._decimal);
                break;

            default:
                _typeUnion._unionTypes._byref = UnsafeMethods.ConvertIntPtrByrefToPtr(ref value._typeUnion._unionTypes._byref);
                break;
            }
            VariantType = (value.VariantType | VarEnum.VT_BYREF);
        }
Exemple #2
0
 public void SetAsByrefDecimal(ref Decimal value)
 {
     Debug.Assert(IsEmpty); // The setter can only be called once as VariantClear might be needed otherwise
     VariantType = (VarEnum.VT_DECIMAL | VarEnum.VT_BYREF);
     _typeUnion._unionTypes._byref = UnsafeMethods.ConvertDecimalByrefToPtr(ref value);
 }