public static OrganizationNumber Create(string number) { OrganizationNumber result; try { result = new OrganizationNumber(number); } catch (NinException) { result = null; } return(result); }
public static OrganizationNumber OneRandom(string pattern, int maxTryCount = DefaultRetryCount) { ValidatePattern(pattern, 9); char[] resultChars = new char[9]; OrganizationNumber result = null; for (int tryCounter = 0; tryCounter < maxTryCount; ++tryCounter) { SetFirstDigit(resultChars, pattern); SetMiddleDigits(resultChars, pattern); SetCheckDigit(resultChars, pattern); result = Create(new string(resultChars)); if (result != null) { break; } } return(result); }