Beispiel #1
0
        decimal CrackDecimal()
        {
            // Use a [FieldOffset] union to magically transform our PropVariant into a decimal.
            PVDecimalOuterUnion union = new PVDecimalOuterUnion();

            union.propVar = this;
            decimal value = union.decVal;

            return(value);
        }
Beispiel #2
0
        /// <summary>
        /// Set a decimal  value
        /// </summary>
        /// <param name="value">The new value to set.</param>
        public void SetDecimal(decimal value)
        {
            if (!this.IsNull())
            {
                this.Clear();
            }

            PVDecimalOuterUnion union = new PVDecimalOuterUnion();

            union.decVal = value;

            this = union.propVar;

            // Note we must set vt after writing the 16-byte decimal value (because it overwrites all 16 bytes)!
            valueType = (ushort)VarEnum.VT_DECIMAL;
        }