Exemple #1
0
        /// <summary>
        /// Gets a field value as an integer.
        /// </summary>
        /// <param name="field">Specifies the field to retrieve.</param>
        /// <returns>Integer value of the field, or null if the field is null.</returns>
        /// <exception cref="ArgumentOutOfRangeException">The field is less than 0 or greater than the
        /// number of fields in the Record.</exception>
        /// <remarks><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msirecordgetinteger.asp">MsiRecordGetInteger</a>
        /// </p></remarks>
        /// <seealso cref="GetInteger(int)"/>
        public int?GetNullableInteger(int field)
        {
            this.CheckRange(field);

            int value = RemotableNativeMethods.MsiRecordGetInteger((int)this.Handle, (uint)field);

            if (value == Int32.MinValue)  // MSI_NULL_INTEGER
            {
                return(null);
            }
            return(value);
        }