I have something like that:
But I have an error:Code:Regex reg = new Regex(@"^\d+(\.\d\d)?$");
if (!reg.IsMatch(book.price))
{
}
Error 4 Argument 1: cannot convert from 'decimal' to 'string'
What should I do ?
Printable View
I have something like that:
But I have an error:Code:Regex reg = new Regex(@"^\d+(\.\d\d)?$");
if (!reg.IsMatch(book.price))
{
}
Error 4 Argument 1: cannot convert from 'decimal' to 'string'
What should I do ?
is book.price of type deciaml?
then I suggest you write
Code:book.price.ToString()
If book.price is decimal such the error points, the price is number, there is nothing to check.