thanks for listening
already tried this command line but my variable is not of type string, it is of type short
already tried this command line but my variable is not of type string, it is of type short
public class MyClass
{
public short NumberInput { get; set; }
}
public class MyClassValidator : AbstractValidator<MyClass>
{
public MyClassValidator()
{
RuleFor(x => x.NumberInput)
.Must(BeNumeric)
.WithMessage(">> Put your message here to let the user know that their input is not a valid number <<");
}
private bool BeNumeric(string input) // Line error (short input)
{
int result;
return int.TryParse(input, out result);
}
}