ID Number Validation

This is a class that validates South African Identity Numbers. It is based on the formulas provided by the Department of Home Affairs.
 

Usage

Download the class, and include it in your project. Create the class using the Identity Number string you want to check, and use the properties to extract information and validate it.

Constructors

public IdentityNumber(string identityNumber)

Creates the class from a string Identity Number.

Properties

The following properties are defined for the class:

DateOfBirth

Returns the Date of Birth extracted from the Identity Number.

Gender

The gender from the person's Identity Number.

Citizenship

Indicates whether the Identity Number refers to a South African Citizen or a foreigner.

IsUsable

True if the Identity Number can be parsed and used. Does not imply that the Identity Number is Valid though.

IsValid

True if the Identity Number is valid. This is determined be whether the Identity Number is usable, and a CDV check on the number.