Exemplo n.º 1
0
        /// <summary>
        /// Gets CountryCode object from map
        /// </summary>
        /// <param name="code">2 or 3 letters code for country</param>
        /// <returns>Found CountryCodeItem object or null if it is not found</returns>
        public static CountryCodeEntry GetCountryCode(string code)
        {
            CountryCodeEntry result = null;
            CountryCode cc = new CountryCode();

            if (!string.IsNullOrEmpty( code ))
            {
                switch (code.Length)
                {
                    case 2:
                        result = cc.getByAlpha2( code.ToUpper() );
                        break;
                    case 3:
                        result = cc.getByAlpha3( code.ToUpper() );
                        break;
                }
            }

            return result;
        }
Exemplo n.º 2
0
 public CountryCodeEntry GetCountryCode() => CountryCode.GetCountryCode(IbanUtils.GetCountryCode(Value));