public static bool TryParse(string input, out PhoneNumber result) { var parseResult = new PhoneNumberResult(); parseResult.Init(PhoneNumberParseThrowStyle.None); if (TryParsePhoneNumber(input, ref parseResult)) { result = parseResult.ParsedPhoneNumber; return(true); } else { result = PhoneNumber.Empty; return(false); } }
public static PhoneNumber Parse(string input) { if (input == null) { throw new ArgumentNullException("input"); } var result = new PhoneNumberResult(); result.Init(PhoneNumberParseThrowStyle.AllButOverflow); if (TryParsePhoneNumber(input, ref result)) { return(result.ParsedPhoneNumber); } else { throw result.GetPhoneNumberParseException(); } }