We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have some lookup extensions.. I could submit a pr but I currently have alias support built in....
public List<string> GetAllNames() { return Country.Countries.Select(c => c.Name).ToList(); } public List<Country> GetCountryByPartialName(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); return Country.Countries.Where(c => CultureInfo.InvariantCulture.CompareInfo.IndexOf(c.Name, name, CompareOptions.IgnoreCase) >= 0).ToList(); } public Country GetCountryByFullName(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name)); return Country.Countries.FirstOrDefault(c => String.Equals(c.Name, name, StringComparison.InvariantCultureIgnoreCase)); } public Country GetCountryByAlpha2(string code) { if (string.IsNullOrEmpty(code)) throw new ArgumentNullException(nameof(code)); return Country.Countries.FirstOrDefault(c => c.Alpha2Code == code); } public Country GetCountryByAlpha3(string code) { if (string.IsNullOrEmpty(code)) throw new ArgumentNullException(nameof(code)); return Country.Countries.FirstOrDefault(c => c.Alpha3Code == code); } public static Country GetCountryByNumeric(int code) { if (code <= 0 || code > 1000) throw new ArgumentOutOfRangeException(nameof(code)); return Country.Countries.FirstOrDefault(c => c.NumericCode == code); }
The text was updated successfully, but these errors were encountered:
Would you like me to submit a pr for the above minus the alias lookup?
Sorry, something went wrong.
No branches or pull requests
I have some lookup extensions.. I could submit a pr but I currently have alias support built in....
The text was updated successfully, but these errors were encountered: