This is the property declaration in question:
[RangeValidator(1,RangeBoundaryType.Inclusive,255,RangeBoundaryType.Inclusive,MessageTemplate = 'StartFlexibility is out of range')] public byte StartFlexibility { get; set; }
When the validate method is called, a FormatException is thrown telling me that the value type needs to be Int32.
How to fix, please?
well… the quick obvious fix will be change the type to short or int,
but another observation i want to do, is with the range. You are telling the RangeValidator to take a inclusive range between 1 and 256, but you just can assign a byte value till 255, maybe that’s the compiler reason to cry out.
The RangeValidator is also infering the type of the Range from the parameters, so, try casting