public static ArgumentUtilitiesHandle <decimal?> EnsureBetween(this ArgumentUtilitiesHandle <decimal?> hnd, decimal bound1Inclusive, decimal bound2Inclusive) { if (!hnd.Value.HasValue || NumberUtilities.Between(number: hnd.Value.Value, a: bound1Inclusive, b: bound2Inclusive)) { return(hnd); } else { var exceptionMessage = $"{(hnd.IsProp ? $"Указано недопустимое значение свойства '{hnd.Name}'.{Environment.NewLine}" : string.Empty)}{FormatXResource(typeof(ArgumentOutOfRangeException), "OutOfRange/WithRange", (bound1Inclusive > bound2Inclusive ? bound2Inclusive : bound1Inclusive).ToString("g"), (bound2Inclusive > bound1Inclusive ? bound2Inclusive : bound1Inclusive).ToString("g"))}"; throw hnd.ExceptionFactory?.Invoke(message: exceptionMessage) ?? new ArgumentOutOfRangeException(paramName: hnd.Name, message: exceptionMessage); } }
public static bool TryParse(this string value, IFormatProvider formatProvider, out int?result) => NumberUtilities.TryParse(value, formatProvider, out result);
public static bool TryParse(this string value, out int?result) => NumberUtilities.TryParse(value, out result);
public static bool TryParseInvariant(this string value, out long?result) => NumberUtilities.TryParseInvariant(value, out result);