/// <summary> /// Determines whether this instance and another specified <see cref="Cnpj"/> object have the same value /// </summary> /// <param name="cnpj">The CNPJ to compare to this instance</param> /// <returns>if the value of the value parameter is the same as this instance; otherwise, false</returns> public bool Equals(Cnpj cnpj) { if (cnpj == null) { return(false); } return(this.parsedValue == cnpj.parsedValue); }
/// <summary> /// Tries to create a new instance of <see cref="Cnpj"/> from a CNPJ string /// </summary> /// <param name="value">a CNPJ string</param> /// <param name="cnpj">the new instance of <see cref="Cnpj"/></param> /// <param name="punctuation">the punctuation setting to /// how validation must be handled</param> /// <returns>true if CNPJ string is valid; false, otherwise</returns> public static bool TryParse(string value, out Cnpj cnpj, CnpjPunctuation punctuation) { var parsed = false; try { cnpj = new Cnpj(value, punctuation); parsed = true; } catch (ArgumentException) { cnpj = null; parsed = false; } return(parsed); }
/// <summary> /// Tries to create a new instance of <see cref="Cnpj"/> from a CNPJ string /// </summary> /// <param name="value">a CNPJ string</param> /// <param name="cnpj">the new instance of <see cref="Cnpj"/></param> /// <returns>true if CNPJ string is valid; false, otherwise</returns> public static bool TryParse(string value, out Cnpj cnpj) { return(Cnpj.TryParse(value, out cnpj, CnpjPunctuation.Loose)); }
/// <summary> /// Creates a new instance of <see cref="Cnpj"/> from a CNPJ string /// </summary> /// <param name="value">a CNPJ string</param> /// <returns>the new instance of <see cref="Cnpj"/></returns> public static Cnpj Parse(string value) { return(Cnpj.Parse(value, CnpjPunctuation.Loose)); }