Convert decimal currency to an integer
Maybe it is intentionally(?):

I would expect CurrencyToInt(234.567m, "USD") to return 23457, but it returns 23456?



Instead of the rather unclear if-statements it is more readable with a switch:

public static int CurrencyToInt(decimal amount, string currencyCode)
{
  var precision = 0;

  currencyCode = currencyCode?.ToUpperInvariant();

  switch (currencyCode)
  {
    case "BHD": case "IQD": case "JOD": case "KWD": case "LYD": case "OMR": case "TND":
      precision = 3;
      break;
    case "AED": case "AFN": case "ALL": case "AMD": case "ANG": case "AOA": case "ARS": case "AUD": case "AWG": case "AZN": case "BAM": case "BBD": case "BDT": case "BGN": case "BMD":
    case "BND": case "BOB": case "BRL": case "BSD": case "BTN": case "BWP": case "BZD": case "CAD": case "CDF": case "CHF": case "CNY": case "COP": case "CRC": case "CUC": case "CUP":
    case "CZK": case "DKK": case "DOP": case "DZD": case "EGP": case "ERN": case "ETB": case "EUR": case "FJD": case "FKP": case "GBP": case "GEL": case "GGP": case "GHS": case "GIP":
....




As stated in the comments the whole thing can be boiled down to 3 lines of code, if you use the framework:

public static int CurrencyToIntByCulture(decimal amount, string currencyCode)
{
  CultureInfo culture = new CultureInfo(currencyCode);
  int precision = culture.NumberFormat.CurrencyDecimalDigits;
  return (int)(amount * (decimal)Math.Pow(10, precision));

  // Or?: return (int)Math.Round((amount * (decimal)Math.Pow(10, precision)));
}


But culture.NumberFormat.CurrencyDecimalDigits returns different numbers of decimals for certain cultures, so maybe you have special needs?