public static ValidateTarget <double?> IsInfinity([ValidatedNotNull] this ValidateTarget <double?> target, Func <string> getErrorMessage = null) { if (!target.Value.HasValue || !double.IsInfinity(target.Value.Value)) { ExceptionFactory.ThrowException(target.Traits.OutOfRangeExceptionType, getErrorMessage != null ? getErrorMessage.Invoke() : ErrorMessageFactory.ShouldBeInfinity(target)); } return(target); }