public static Birthday ( int minAge = 18, int maxAge = 65 ) : System.DateTime | ||
minAge | int | The minimum years into the past. |
maxAge | int | The maximum years into the past. |
return | System.DateTime |
/// <summary> /// Generates a Singaporean National Registration Identity Card (NRIC) for holder who is /// born between specified ages. /// </summary> /// <param name="validChecksum"> /// Indicates whether the generated NRIC has a valid checksum or not /// </param> /// <param name="minAge">Minimum age of the holder</param> /// <param name="maxAge">Maximum age of the holder</param> /// <returns>The generated NRIC</returns> /// <remarks> /// Description of the NRIC standard is at /// <see href="https://en.wikipedia.org/wiki/National_Registration_Identity_Card" />. This /// ID was issued for the first time in 1965 in Singapore. See also: <see href="https://github.com/stympy/faker/blob/master/lib/faker/code.rb#L32" /> /// </remarks> public static string NRIC(bool validChecksum = true, int minAge = 18, int maxAge = 65) { var birthYear = Date.Birthday(minAge, maxAge).Year; var prefix = birthYear < 2000 ? 'S' : 'T'; var v = new int[7]; for (int i = 0; i < 7; i++) { v[i] = RandomNumber.Next(10); } var checksum = ComputeChecksumNric(v, prefix, validChecksum); return(string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", prefix, string.Join(string.Empty, v), checksum)); }
/// <summary> /// Generates an Italian Fiscal Code /// </summary> /// <param name="validChecksum"> /// Indicates whether the generated Fiscal Code has a valid checksum or not /// </param> /// <param name="minAge">Minimum age of the holder</param> /// <param name="maxAge">Maximum age of the holder</param> /// <returns>The generated Fiscal Code</returns> /// <remarks>Description of the Fiscal Code standard is at https://en.wikipedia.org/wiki/Italian_fiscal_code_card</remarks> public static string FiscalCode(bool validChecksum, int minAge, int maxAge) { var birthday = Date.Birthday(minAge, maxAge); return(FiscalCode(null, null, birthday, validChecksum)); }
/// <summary> /// Generates an Italian Fiscal Code /// </summary> /// <param name="minAge">Minimum age of the holder</param> /// <param name="maxAge">Maximum age of the holder</param> /// <returns>The generated Fiscal Code</returns> /// <remarks>Description of the Fiscal Code standard is at https://en.wikipedia.org/wiki/Italian_fiscal_code_card</remarks> public static string FiscalCode(int minAge, int maxAge) { var birthday = Date.Birthday(minAge, maxAge); return(FiscalCode(null, null, birthday, true)); }
/// <summary> /// Generates an Italian Fiscal Code /// </summary> /// <param name="validChecksum"> /// Indicates whether the generated Fiscal Code has a valid checksum or not /// </param> /// <returns>The generated Fiscal Code</returns> /// <remarks>Description of the Fiscal Code standard is at https://en.wikipedia.org/wiki/Italian_fiscal_code_card</remarks> public static string FiscalCode(bool validChecksum = true) { var birthday = Date.Birthday(); return(FiscalCode(null, null, birthday, validChecksum)); }