internal ArgumentUtilitiesHandle(T value, string name, bool isPropertyValue, ExceptionFactoryDelegate2 exceptionFactory) { Value = value; Name = string.IsNullOrEmpty(name) ? nameof(name) : name; IsProp = isPropertyValue; ExceptionFactory = exceptionFactory; }
internal ArgumentUtilitiesHandle(T value, string name) { Value = value; Name = string.IsNullOrEmpty(name) ? nameof(name) : name; IsProp = false; ExceptionFactory = null; }
// TODO: Put strings into the resources. // internal static Exception Internal_CreateNullValueException(bool isPropertyValue, string name, ExceptionFactoryDelegate2 exceptionFactory = default) { var exceptionMessage = isPropertyValue ? $"Не указано значение свойства '{name}'." : $"Значение не может быть '{FormatStringUtilitiesCoreL0.GetNullValueText()}'."; return (exceptionFactory?.Invoke(message: exceptionMessage) ?? new ArgumentNullException(message: exceptionMessage, paramName: name)); }
public static ArgumentUtilitiesHandle <T> PropArg <T>(this T value, string name, ExceptionFactoryDelegate2 exceptionFactory) => new ArgumentUtilitiesHandle <T>(value: value, name: name, isPropertyValue: true, exceptionFactory: exceptionFactory);