コード例 #1
0
        public PolicyUnit(long value, PolicyUnitType type)
        {
            if (type == PolicyUnitType.Percentage)
            {
                if ((value < 0) || (value > 100))
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value"));
            }
            else if (type == PolicyUnitType.Extents)
            {
                if (value < 0)
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value"));                
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("type"));
            }

            this.type = type;
            this.value = value;
        }
コード例 #2
0
ファイル: PolicyUnit.cs プロジェクト: dox0/DotNet471RS3
        public PolicyUnit(long value, PolicyUnitType type)
        {
            if (type == PolicyUnitType.Percentage)
            {
                if ((value < 0) || (value > 100))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value"));
                }
            }
            else if (type == PolicyUnitType.Extents)
            {
                if (value < 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("value"));
                }
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("type"));
            }

            this.type  = type;
            this.value = value;
        }