private static void ConverterContracts <TEnum, TResult>() where TEnum : struct, IComparable, IFormattable, IConvertible where TResult : struct, IComparable, IFormattable, IConvertible, IComparable <TResult>, IEquatable <TResult> { Contracts.Requires.That(typeof(TEnum).IsEnum); Contracts.Requires.That(EnumUtilities.IsValidUnderlyingTypeForEnum <TResult>()); Contracts.Requires.That(EnumUtilities.IsEnumConvertibleTo <TEnum, TResult>()); }
/// <summary> /// Initializes a new instance of the <see cref="AbstractEnumValidator{TEnum}"/> class. /// </summary> public AbstractEnumValidator() { Contracts.Requires.That(typeof(TEnum).IsEnum); Contracts.Requires.That(EnumUtilities.IsContiguousEnum <TEnum>()); TEnum[] values = EnumUtilities.GetEnumValues <TEnum>(); this.MinValue = values.Min(); this.MaxValue = values.Max(); }