示例#1
0
        protected void TestInputSpecialValue(AllowedSpecialValues allowedValues, AllowedSpecialValues valueToCompare)
        {
            if ((allowedValues & valueToCompare) != valueToCompare)
            {
                switch (valueToCompare)
                {
                case AllowedSpecialValues.NaN:
                    throw new InvalidDataException("Value to parse shouldn't be NaN.");

                case AllowedSpecialValues.PositiveInfinity:
                    throw new InvalidDataException("Value to parse shouldn't be Positive Infinity.");

                case AllowedSpecialValues.NegativeInfinity:
                    throw new InvalidDataException("Value to parse shouldn't be Negative Infinity.");
                }
            }
        }
示例#2
0
 /// <summary>
 /// Test if the special value is allowed in this editor.
 /// </summary>
 /// <param name="pAllowedValues">The allowed values.</param>
 /// <param name="pValueToCompare">The value to test.</param>
 /// <returns>True if the special value is allowed, false otherwise.</returns>
 protected bool TestInputSpecialValue(AllowedSpecialValues pAllowedValues, AllowedSpecialValues pValueToCompare)
 {
     return((pAllowedValues & pValueToCompare) == pValueToCompare);
 }