Reimplemented from System.ComponentModel.DataAnnotations.ValidationAttribute.
Definition at line 12 of file CreditCardAttribute.cs.
13 {
15 {
16 return true;
17 }
19 {
20 return false;
21 }
22 string text2 =
text.Replace(
"-",
string.
Empty);
23 text2 = text2.Replace(
" ",
string.
Empty);
24 int num = 0;
25 bool flag = false;
26 for (int num2 = text2.Length - 1; num2 >= 0; num2--)
27 {
28 char c = text2[num2];
29 if (c < '0' || c > '9')
30 {
31 return false;
32 }
33 int num3 = (c - 48) * ((!flag) ? 1 : 2);
34 flag = !flag;
35 while (num3 > 0)
36 {
37 num += num3 % 10;
38 num3 /= 10;
39 }
40 }
41 return num % 10 == 0;
42 }
References System.text, and System.value.