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; }
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; }