using System;
2
3/// <summary>
4/// Summary description for IDCardValid
5/// </summary>
6public class IDCardValid
7{
8 public IDCardValid()
9 {
10 //
11 // TODO: Add constructor logic here
12 //
13 }
14
15 /// <summary>
16 /// 验证身份证号码
17 /// </summary>
18 /// <param name="Id">身份证号码</param>
19 /// <returns>验证成功为True,否则为False</returns>
20 public static bool CheckIDCard(string Id)
21 {
22 if (Id.Length == 18)
23 {
24 bool check = CheckIDCard18(Id);
25 return check;
26 }
27 else if (Id.Length == 15)
28 {
29 bool check = CheckIDCard15(Id);
30 return check;
31 }
32 else
33 {
34 return false;
35 }
36 }
37
38 身份证号码验证
106}
107
源代码演示下载:
https://files.cnblogs.com/moozi/IDCardValid.rar