答案 0 :(得分:7)
我知道这已经过时了,但我自己也遇到了这个问题,并认为问题的代码解决方案可能会有所帮助。
<强> VB.Net 强>
Namespace Utils.CurrencyUtils
Public Class Iso4217Lookup
' Michael Krzenski
' 2/20/2013
' ISO4217 Information gathered from:
' http://en.wikipedia.org/wiki/ISO_4217
' http://www.commondatahub.com/static/geography/currency/country_currency_codes.0000000001.html
Private Shared _notFoundDefinition As New Iso4217Definition("NotFound", -1, -1)
Private Shared _definitionCollection As New List(Of Iso4217Definition) From {
New Iso4217Definition("AED", 784, 2),
New Iso4217Definition("AFN", 971, 2),
New Iso4217Definition("ALL", 8, 2),
New Iso4217Definition("AMD", 51, 2),
New Iso4217Definition("ANG", 532, 2),
New Iso4217Definition("AOA", 973, 2),
New Iso4217Definition("ARS", 32, 2),
New Iso4217Definition("AUD", 36, 2),
New Iso4217Definition("AWG", 533, 2),
New Iso4217Definition("AZN", 944, 2),
New Iso4217Definition("BAM", 977, 2),
New Iso4217Definition("BBD", 52, 2),
New Iso4217Definition("BDT", 50, 2),
New Iso4217Definition("BGN", 975, 2),
New Iso4217Definition("BHD", 48, 3),
New Iso4217Definition("BIF", 108, 0),
New Iso4217Definition("BMD", 60, 2),
New Iso4217Definition("BND", 96, 2),
New Iso4217Definition("BOB", 68, 2),
New Iso4217Definition("BOV", 984, 2),
New Iso4217Definition("BRL", 986, 2),
New Iso4217Definition("BSD", 44, 2),
New Iso4217Definition("BTN", 64, 2),
New Iso4217Definition("BWP", 72, 2),
New Iso4217Definition("BYR", 974, 0),
New Iso4217Definition("BZD", 84, 2),
New Iso4217Definition("CAD", 124, 2),
New Iso4217Definition("CDF", 976, 2),
New Iso4217Definition("CHE", 947, 2),
New Iso4217Definition("CHF", 756, 2),
New Iso4217Definition("CHW", 948, 2),
New Iso4217Definition("CLF", 990, 0),
New Iso4217Definition("CLP", 152, 0),
New Iso4217Definition("CNY", 156, 2),
New Iso4217Definition("COP", 170, 2),
New Iso4217Definition("COU", 970, 2),
New Iso4217Definition("CRC", 188, 2),
New Iso4217Definition("CUC", 931, 2),
New Iso4217Definition("CUP", 192, 2),
New Iso4217Definition("CVE", 132, 0),
New Iso4217Definition("CZK", 203, 2),
New Iso4217Definition("DJF", 262, 0),
New Iso4217Definition("DKK", 208, 2),
New Iso4217Definition("DOP", 214, 2),
New Iso4217Definition("DZD", 12, 2),
New Iso4217Definition("EGP", 818, 2),
New Iso4217Definition("ERN", 232, 2),
New Iso4217Definition("ETB", 230, 2),
New Iso4217Definition("EUR", 978, 2),
New Iso4217Definition("FJD", 242, 2),
New Iso4217Definition("FKP", 238, 2),
New Iso4217Definition("GBP", 826, 2),
New Iso4217Definition("GEL", 981, 2),
New Iso4217Definition("GHS", 936, 2),
New Iso4217Definition("GIP", 292, 2),
New Iso4217Definition("GMD", 270, 2),
New Iso4217Definition("GNF", 324, 0),
New Iso4217Definition("GTQ", 320, 2),
New Iso4217Definition("GYD", 328, 2),
New Iso4217Definition("HKD", 344, 2),
New Iso4217Definition("HNL", 340, 2),
New Iso4217Definition("HRK", 191, 2),
New Iso4217Definition("HTG", 332, 2),
New Iso4217Definition("HUF", 348, 2),
New Iso4217Definition("IDR", 360, 2),
New Iso4217Definition("ILS", 376, 2),
New Iso4217Definition("INR", 356, 2),
New Iso4217Definition("IQD", 368, 3),
New Iso4217Definition("IRR", 364, 0),
New Iso4217Definition("ISK", 352, 0),
New Iso4217Definition("JMD", 388, 2),
New Iso4217Definition("JOD", 400, 3),
New Iso4217Definition("JPY", 392, 0),
New Iso4217Definition("KES", 404, 2),
New Iso4217Definition("KGS", 417, 2),
New Iso4217Definition("KHR", 116, 2),
New Iso4217Definition("KMF", 174, 0),
New Iso4217Definition("KPW", 408, 0),
New Iso4217Definition("KRW", 410, 0),
New Iso4217Definition("KWD", 414, 3),
New Iso4217Definition("KYD", 136, 2),
New Iso4217Definition("KZT", 398, 2),
New Iso4217Definition("LAK", 418, 0),
New Iso4217Definition("LBP", 422, 0),
New Iso4217Definition("LKR", 144, 2),
New Iso4217Definition("LRD", 430, 2),
New Iso4217Definition("LSL", 426, 2),
New Iso4217Definition("LTL", 440, 2),
New Iso4217Definition("LVL", 428, 2),
New Iso4217Definition("LYD", 434, 3),
New Iso4217Definition("MAD", 504, 2),
New Iso4217Definition("MDL", 498, 2),
New Iso4217Definition("MGA", 969, 0.7),
New Iso4217Definition("MKD", 807, 0),
New Iso4217Definition("MMK", 104, 0),
New Iso4217Definition("MNT", 496, 2),
New Iso4217Definition("MOP", 446, 2),
New Iso4217Definition("MRO", 478, 0.7),
New Iso4217Definition("MUR", 480, 2),
New Iso4217Definition("MVR", 462, 2),
New Iso4217Definition("MWK", 454, 2),
New Iso4217Definition("MXN", 484, 2),
New Iso4217Definition("MXV", 979, 2),
New Iso4217Definition("MYR", 458, 2),
New Iso4217Definition("MZN", 943, 2),
New Iso4217Definition("NAD", 516, 2),
New Iso4217Definition("NGN", 566, 2),
New Iso4217Definition("NIO", 558, 2),
New Iso4217Definition("NOK", 578, 2),
New Iso4217Definition("NPR", 524, 2),
New Iso4217Definition("NZD", 554, 2),
New Iso4217Definition("OMR", 512, 3),
New Iso4217Definition("PAB", 590, 2),
New Iso4217Definition("PEN", 604, 2),
New Iso4217Definition("PGK", 598, 2),
New Iso4217Definition("PHP", 608, 2),
New Iso4217Definition("PKR", 586, 2),
New Iso4217Definition("PLN", 985, 2),
New Iso4217Definition("PYG", 600, 0),
New Iso4217Definition("QAR", 634, 2),
New Iso4217Definition("RON", 946, 2),
New Iso4217Definition("RSD", 941, 2),
New Iso4217Definition("RUB", 643, 2),
New Iso4217Definition("RWF", 646, 0),
New Iso4217Definition("SAR", 682, 2),
New Iso4217Definition("SBD", 90, 2),
New Iso4217Definition("SCR", 690, 2),
New Iso4217Definition("SDG", 938, 2),
New Iso4217Definition("SEK", 752, 2),
New Iso4217Definition("SGD", 702, 2),
New Iso4217Definition("SHP", 654, 2),
New Iso4217Definition("SLL", 694, 0),
New Iso4217Definition("SOS", 706, 2),
New Iso4217Definition("SRD", 968, 2),
New Iso4217Definition("SSP", 728, 2),
New Iso4217Definition("STD", 678, 0),
New Iso4217Definition("SYP", 760, 2),
New Iso4217Definition("SZL", 748, 2),
New Iso4217Definition("THB", 764, 2),
New Iso4217Definition("TJS", 972, 2),
New Iso4217Definition("TMT", 934, 2),
New Iso4217Definition("TND", 788, 3),
New Iso4217Definition("TOP", 776, 2),
New Iso4217Definition("TRY", 949, 2),
New Iso4217Definition("TTD", 780, 2),
New Iso4217Definition("TWD", 901, 2),
New Iso4217Definition("TZS", 834, 2),
New Iso4217Definition("UAH", 980, 2),
New Iso4217Definition("UGX", 800, 2),
New Iso4217Definition("USD", 840, 2),
New Iso4217Definition("USN", 997, 2),
New Iso4217Definition("USS", 998, 2),
New Iso4217Definition("UYI", 940, 0),
New Iso4217Definition("UYU", 858, 2),
New Iso4217Definition("UZS", 860, 2),
New Iso4217Definition("VEF", 937, 2),
New Iso4217Definition("VND", 704, 0),
New Iso4217Definition("VUV", 548, 0),
New Iso4217Definition("WST", 882, 2),
New Iso4217Definition("XAF", 950, 0),
New Iso4217Definition("XCD", 951, 2),
New Iso4217Definition("XOF", 952, 0),
New Iso4217Definition("XPF", 953, 0),
New Iso4217Definition("YER", 886, 2),
New Iso4217Definition("ZAR", 710, 2),
New Iso4217Definition("ZMW", 967, 2)
}
Public Shared Function LookupByCode(ByVal code As String) As Iso4217Definition
Dim def = _definitionCollection.Where(Function(d) d.Code = code.ToUpper()).SingleOrDefault
If def Is Nothing Then def = _notFoundDefinition
Return def
End Function
Public Shared Function LookupByNumber(ByVal number As Integer) As Iso4217Definition
Dim def = _definitionCollection.Where(Function(d) d.Number = number).SingleOrDefault
If def Is Nothing Then def = _notFoundDefinition
Return def
End Function
Public Class Iso4217Definition
Private _code As String
Private _number As Integer
Private _exponent As Integer
Public ReadOnly Property Code As String
Get
Return _code
End Get
End Property
Public ReadOnly Property Number As Integer
Get
Return _number
End Get
End Property
Public ReadOnly Property Exponent As Integer
Get
Return _exponent
End Get
End Property
Public Sub New(ByVal code As String,
ByVal number As Integer,
ByVal exponent As Integer)
_code = code
_number = number
_exponent = exponent
End Sub
End Class
End Class
End Namespace
<强> C#强>
namespace Utils.CurrencyUtils
{
public class Iso4217Lookup
{
// Michael Krzenski
// 2/20/2013
// ISO4217 Information gathered from:
// http://en.wikipedia.org/wiki/ISO_4217
// http://www.commondatahub.com/static/geography/currency/country_currency_codes.0000000001.html
private static Iso4217Definition _notFoundDefinition = new Iso4217Definition("NotFound", -1, -1);
private static List<Iso4217Definition> _definitionCollection = new List<Iso4217Definition> {
new Iso4217Definition("AED", 784, 2),
new Iso4217Definition("AFN", 971, 2),
new Iso4217Definition("ALL", 8, 2),
new Iso4217Definition("AMD", 51, 2),
new Iso4217Definition("ANG", 532, 2),
new Iso4217Definition("AOA", 973, 2),
new Iso4217Definition("ARS", 32, 2),
new Iso4217Definition("AUD", 36, 2),
new Iso4217Definition("AWG", 533, 2),
new Iso4217Definition("AZN", 944, 2),
new Iso4217Definition("BAM", 977, 2),
new Iso4217Definition("BBD", 52, 2),
new Iso4217Definition("BDT", 50, 2),
new Iso4217Definition("BGN", 975, 2),
new Iso4217Definition("BHD", 48, 3),
new Iso4217Definition("BIF", 108, 0),
new Iso4217Definition("BMD", 60, 2),
new Iso4217Definition("BND", 96, 2),
new Iso4217Definition("BOB", 68, 2),
new Iso4217Definition("BOV", 984, 2),
new Iso4217Definition("BRL", 986, 2),
new Iso4217Definition("BSD", 44, 2),
new Iso4217Definition("BTN", 64, 2),
new Iso4217Definition("BWP", 72, 2),
new Iso4217Definition("BYR", 974, 0),
new Iso4217Definition("BZD", 84, 2),
new Iso4217Definition("CAD", 124, 2),
new Iso4217Definition("CDF", 976, 2),
new Iso4217Definition("CHE", 947, 2),
new Iso4217Definition("CHF", 756, 2),
new Iso4217Definition("CHW", 948, 2),
new Iso4217Definition("CLF", 990, 0),
new Iso4217Definition("CLP", 152, 0),
new Iso4217Definition("CNY", 156, 2),
new Iso4217Definition("COP", 170, 2),
new Iso4217Definition("COU", 970, 2),
new Iso4217Definition("CRC", 188, 2),
new Iso4217Definition("CUC", 931, 2),
new Iso4217Definition("CUP", 192, 2),
new Iso4217Definition("CVE", 132, 0),
new Iso4217Definition("CZK", 203, 2),
new Iso4217Definition("DJF", 262, 0),
new Iso4217Definition("DKK", 208, 2),
new Iso4217Definition("DOP", 214, 2),
new Iso4217Definition("DZD", 12, 2),
new Iso4217Definition("EGP", 818, 2),
new Iso4217Definition("ERN", 232, 2),
new Iso4217Definition("ETB", 230, 2),
new Iso4217Definition("EUR", 978, 2),
new Iso4217Definition("FJD", 242, 2),
new Iso4217Definition("FKP", 238, 2),
new Iso4217Definition("GBP", 826, 2),
new Iso4217Definition("GEL", 981, 2),
new Iso4217Definition("GHS", 936, 2),
new Iso4217Definition("GIP", 292, 2),
new Iso4217Definition("GMD", 270, 2),
new Iso4217Definition("GNF", 324, 0),
new Iso4217Definition("GTQ", 320, 2),
new Iso4217Definition("GYD", 328, 2),
new Iso4217Definition("HKD", 344, 2),
new Iso4217Definition("HNL", 340, 2),
new Iso4217Definition("HRK", 191, 2),
new Iso4217Definition("HTG", 332, 2),
new Iso4217Definition("HUF", 348, 2),
new Iso4217Definition("IDR", 360, 2),
new Iso4217Definition("ILS", 376, 2),
new Iso4217Definition("INR", 356, 2),
new Iso4217Definition("IQD", 368, 3),
new Iso4217Definition("IRR", 364, 0),
new Iso4217Definition("ISK", 352, 0),
new Iso4217Definition("JMD", 388, 2),
new Iso4217Definition("JOD", 400, 3),
new Iso4217Definition("JPY", 392, 0),
new Iso4217Definition("KES", 404, 2),
new Iso4217Definition("KGS", 417, 2),
new Iso4217Definition("KHR", 116, 2),
new Iso4217Definition("KMF", 174, 0),
new Iso4217Definition("KPW", 408, 0),
new Iso4217Definition("KRW", 410, 0),
new Iso4217Definition("KWD", 414, 3),
new Iso4217Definition("KYD", 136, 2),
new Iso4217Definition("KZT", 398, 2),
new Iso4217Definition("LAK", 418, 0),
new Iso4217Definition("LBP", 422, 0),
new Iso4217Definition("LKR", 144, 2),
new Iso4217Definition("LRD", 430, 2),
new Iso4217Definition("LSL", 426, 2),
new Iso4217Definition("LTL", 440, 2),
new Iso4217Definition("LVL", 428, 2),
new Iso4217Definition("LYD", 434, 3),
new Iso4217Definition("MAD", 504, 2),
new Iso4217Definition("MDL", 498, 2),
new Iso4217Definition("MGA", 969, 0.7),
new Iso4217Definition("MKD", 807, 0),
new Iso4217Definition("MMK", 104, 0),
new Iso4217Definition("MNT", 496, 2),
new Iso4217Definition("MOP", 446, 2),
new Iso4217Definition("MRO", 478, 0.7),
new Iso4217Definition("MUR", 480, 2),
new Iso4217Definition("MVR", 462, 2),
new Iso4217Definition("MWK", 454, 2),
new Iso4217Definition("MXN", 484, 2),
new Iso4217Definition("MXV", 979, 2),
new Iso4217Definition("MYR", 458, 2),
new Iso4217Definition("MZN", 943, 2),
new Iso4217Definition("NAD", 516, 2),
new Iso4217Definition("NGN", 566, 2),
new Iso4217Definition("NIO", 558, 2),
new Iso4217Definition("NOK", 578, 2),
new Iso4217Definition("NPR", 524, 2),
new Iso4217Definition("NZD", 554, 2),
new Iso4217Definition("OMR", 512, 3),
new Iso4217Definition("PAB", 590, 2),
new Iso4217Definition("PEN", 604, 2),
new Iso4217Definition("PGK", 598, 2),
new Iso4217Definition("PHP", 608, 2),
new Iso4217Definition("PKR", 586, 2),
new Iso4217Definition("PLN", 985, 2),
new Iso4217Definition("PYG", 600, 0),
new Iso4217Definition("QAR", 634, 2),
new Iso4217Definition("RON", 946, 2),
new Iso4217Definition("RSD", 941, 2),
new Iso4217Definition("RUB", 643, 2),
new Iso4217Definition("RWF", 646, 0),
new Iso4217Definition("SAR", 682, 2),
new Iso4217Definition("SBD", 90, 2),
new Iso4217Definition("SCR", 690, 2),
new Iso4217Definition("SDG", 938, 2),
new Iso4217Definition("SEK", 752, 2),
new Iso4217Definition("SGD", 702, 2),
new Iso4217Definition("SHP", 654, 2),
new Iso4217Definition("SLL", 694, 0),
new Iso4217Definition("SOS", 706, 2),
new Iso4217Definition("SRD", 968, 2),
new Iso4217Definition("SSP", 728, 2),
new Iso4217Definition("STD", 678, 0),
new Iso4217Definition("SYP", 760, 2),
new Iso4217Definition("SZL", 748, 2),
new Iso4217Definition("THB", 764, 2),
new Iso4217Definition("TJS", 972, 2),
new Iso4217Definition("TMT", 934, 2),
new Iso4217Definition("TND", 788, 3),
new Iso4217Definition("TOP", 776, 2),
new Iso4217Definition("TRY", 949, 2),
new Iso4217Definition("TTD", 780, 2),
new Iso4217Definition("TWD", 901, 2),
new Iso4217Definition("TZS", 834, 2),
new Iso4217Definition("UAH", 980, 2),
new Iso4217Definition("UGX", 800, 2),
new Iso4217Definition("USD", 840, 2),
new Iso4217Definition("USN", 997, 2),
new Iso4217Definition("USS", 998, 2),
new Iso4217Definition("UYI", 940, 0),
new Iso4217Definition("UYU", 858, 2),
new Iso4217Definition("UZS", 860, 2),
new Iso4217Definition("VEF", 937, 2),
new Iso4217Definition("VND", 704, 0),
new Iso4217Definition("VUV", 548, 0),
new Iso4217Definition("WST", 882, 2),
new Iso4217Definition("XAF", 950, 0),
new Iso4217Definition("XCD", 951, 2),
new Iso4217Definition("XOF", 952, 0),
new Iso4217Definition("XPF", 953, 0),
new Iso4217Definition("YER", 886, 2),
new Iso4217Definition("ZAR", 710, 2),
new Iso4217Definition("ZMW", 967, 2)
};
public static Iso4217Definition LookupByCode(string code)
{
dynamic def = _definitionCollection.Where(d => d.Code == code.ToUpper()).SingleOrDefault;
if (def == null)
def = _notFoundDefinition;
return def;
}
public static Iso4217Definition LookupByNumber(int number)
{
dynamic def = _definitionCollection.Where(d => d.Number == number).SingleOrDefault;
if (def == null)
def = _notFoundDefinition;
return def;
}
public class Iso4217Definition
{
private string _code;
private int _number;
private int _exponent;
public string Code {
get { return _code; }
}
public int Number {
get { return _number; }
}
public int Exponent {
get { return _exponent; }
}
public Iso4217Definition(string code, int number, int exponent)
{
_code = code;
_number = number;
_exponent = exponent;
}
}
}
}
答案 1 :(得分:3)
.Net框架中没有ISO3166货币代码(美元等840等)。您可以从RegionInfo
类获得的是ISO4217货币代码(ISOCurrencyCode
)(例如USD)和CurrencySymbol(例如$)。
我担心,您必须下载数据列表并自行进行映射。
答案 2 :(得分:3)
这是一个清理过的C#版本
public class Iso4217Lookup
{
// http://en.wikipedia.org/wiki/ISO_4217
private static readonly List<Iso4217Definition> DefinitionCollection = new List<Iso4217Definition> {
new Iso4217Definition("AED", 784, 2),
new Iso4217Definition("AFN", 971, 2),
new Iso4217Definition("ALL", 8, 2),
new Iso4217Definition("AMD", 51, 2),
new Iso4217Definition("ANG", 532, 2),
new Iso4217Definition("AOA", 973, 2),
new Iso4217Definition("ARS", 32, 2),
new Iso4217Definition("AUD", 36, 2),
new Iso4217Definition("AWG", 533, 2),
new Iso4217Definition("AZN", 944, 2),
new Iso4217Definition("BAM", 977, 2),
new Iso4217Definition("BBD", 52, 2),
new Iso4217Definition("BDT", 50, 2),
new Iso4217Definition("BGN", 975, 2),
new Iso4217Definition("BHD", 48, 3),
new Iso4217Definition("BIF", 108, 0),
new Iso4217Definition("BMD", 60, 2),
new Iso4217Definition("BND", 96, 2),
new Iso4217Definition("BOB", 68, 2),
new Iso4217Definition("BOV", 984, 2),
new Iso4217Definition("BRL", 986, 2),
new Iso4217Definition("BSD", 44, 2),
new Iso4217Definition("BTN", 64, 2),
new Iso4217Definition("BWP", 72, 2),
new Iso4217Definition("BYR", 974, 0),
new Iso4217Definition("BZD", 84, 2),
new Iso4217Definition("CAD", 124, 2),
new Iso4217Definition("CDF", 976, 2),
new Iso4217Definition("CHE", 947, 2),
new Iso4217Definition("CHF", 756, 2),
new Iso4217Definition("CHW", 948, 2),
new Iso4217Definition("CLF", 990, 0),
new Iso4217Definition("CLP", 152, 0),
new Iso4217Definition("CNY", 156, 2),
new Iso4217Definition("COP", 170, 2),
new Iso4217Definition("COU", 970, 2),
new Iso4217Definition("CRC", 188, 2),
new Iso4217Definition("CUC", 931, 2),
new Iso4217Definition("CUP", 192, 2),
new Iso4217Definition("CVE", 132, 0),
new Iso4217Definition("CZK", 203, 2),
new Iso4217Definition("DJF", 262, 0),
new Iso4217Definition("DKK", 208, 2),
new Iso4217Definition("DOP", 214, 2),
new Iso4217Definition("DZD", 12, 2),
new Iso4217Definition("EGP", 818, 2),
new Iso4217Definition("ERN", 232, 2),
new Iso4217Definition("ETB", 230, 2),
new Iso4217Definition("EUR", 978, 2),
new Iso4217Definition("FJD", 242, 2),
new Iso4217Definition("FKP", 238, 2),
new Iso4217Definition("GBP", 826, 2),
new Iso4217Definition("GEL", 981, 2),
new Iso4217Definition("GHS", 936, 2),
new Iso4217Definition("GIP", 292, 2),
new Iso4217Definition("GMD", 270, 2),
new Iso4217Definition("GNF", 324, 0),
new Iso4217Definition("GTQ", 320, 2),
new Iso4217Definition("GYD", 328, 2),
new Iso4217Definition("HKD", 344, 2),
new Iso4217Definition("HNL", 340, 2),
new Iso4217Definition("HRK", 191, 2),
new Iso4217Definition("HTG", 332, 2),
new Iso4217Definition("HUF", 348, 2),
new Iso4217Definition("IDR", 360, 2),
new Iso4217Definition("ILS", 376, 2),
new Iso4217Definition("INR", 356, 2),
new Iso4217Definition("IQD", 368, 3),
new Iso4217Definition("IRR", 364, 0),
new Iso4217Definition("ISK", 352, 0),
new Iso4217Definition("JMD", 388, 2),
new Iso4217Definition("JOD", 400, 3),
new Iso4217Definition("JPY", 392, 0),
new Iso4217Definition("KES", 404, 2),
new Iso4217Definition("KGS", 417, 2),
new Iso4217Definition("KHR", 116, 2),
new Iso4217Definition("KMF", 174, 0),
new Iso4217Definition("KPW", 408, 0),
new Iso4217Definition("KRW", 410, 0),
new Iso4217Definition("KWD", 414, 3),
new Iso4217Definition("KYD", 136, 2),
new Iso4217Definition("KZT", 398, 2),
new Iso4217Definition("LAK", 418, 0),
new Iso4217Definition("LBP", 422, 0),
new Iso4217Definition("LKR", 144, 2),
new Iso4217Definition("LRD", 430, 2),
new Iso4217Definition("LSL", 426, 2),
new Iso4217Definition("LTL", 440, 2),
new Iso4217Definition("LVL", 428, 2),
new Iso4217Definition("LYD", 434, 3),
new Iso4217Definition("MAD", 504, 2),
new Iso4217Definition("MDL", 498, 2),
new Iso4217Definition("MGA", 969, 2),
new Iso4217Definition("MKD", 807, 0),
new Iso4217Definition("MMK", 104, 0),
new Iso4217Definition("MNT", 496, 2),
new Iso4217Definition("MOP", 446, 2),
new Iso4217Definition("MRO", 478, 2),
new Iso4217Definition("MUR", 480, 2),
new Iso4217Definition("MVR", 462, 2),
new Iso4217Definition("MWK", 454, 2),
new Iso4217Definition("MXN", 484, 2),
new Iso4217Definition("MXV", 979, 2),
new Iso4217Definition("MYR", 458, 2),
new Iso4217Definition("MZN", 943, 2),
new Iso4217Definition("NAD", 516, 2),
new Iso4217Definition("NGN", 566, 2),
new Iso4217Definition("NIO", 558, 2),
new Iso4217Definition("NOK", 578, 2),
new Iso4217Definition("NPR", 524, 2),
new Iso4217Definition("NZD", 554, 2),
new Iso4217Definition("OMR", 512, 3),
new Iso4217Definition("PAB", 590, 2),
new Iso4217Definition("PEN", 604, 2),
new Iso4217Definition("PGK", 598, 2),
new Iso4217Definition("PHP", 608, 2),
new Iso4217Definition("PKR", 586, 2),
new Iso4217Definition("PLN", 985, 2),
new Iso4217Definition("PYG", 600, 0),
new Iso4217Definition("QAR", 634, 2),
new Iso4217Definition("RON", 946, 2),
new Iso4217Definition("RSD", 941, 2),
new Iso4217Definition("RUB", 643, 2),
new Iso4217Definition("RWF", 646, 0),
new Iso4217Definition("SAR", 682, 2),
new Iso4217Definition("SBD", 90, 2),
new Iso4217Definition("SCR", 690, 2),
new Iso4217Definition("SDG", 938, 2),
new Iso4217Definition("SEK", 752, 2),
new Iso4217Definition("SGD", 702, 2),
new Iso4217Definition("SHP", 654, 2),
new Iso4217Definition("SLL", 694, 0),
new Iso4217Definition("SOS", 706, 2),
new Iso4217Definition("SRD", 968, 2),
new Iso4217Definition("SSP", 728, 2),
new Iso4217Definition("STD", 678, 0),
new Iso4217Definition("SYP", 760, 2),
new Iso4217Definition("SZL", 748, 2),
new Iso4217Definition("THB", 764, 2),
new Iso4217Definition("TJS", 972, 2),
new Iso4217Definition("TMT", 934, 2),
new Iso4217Definition("TND", 788, 3),
new Iso4217Definition("TOP", 776, 2),
new Iso4217Definition("TRY", 949, 2),
new Iso4217Definition("TTD", 780, 2),
new Iso4217Definition("TWD", 901, 2),
new Iso4217Definition("TZS", 834, 2),
new Iso4217Definition("UAH", 980, 2),
new Iso4217Definition("UGX", 800, 2),
new Iso4217Definition("USD", 840, 2),
new Iso4217Definition("USN", 997, 2),
new Iso4217Definition("USS", 998, 2),
new Iso4217Definition("UYI", 940, 0),
new Iso4217Definition("UYU", 858, 2),
new Iso4217Definition("UZS", 860, 2),
new Iso4217Definition("VEF", 937, 2),
new Iso4217Definition("VND", 704, 0),
new Iso4217Definition("VUV", 548, 0),
new Iso4217Definition("WST", 882, 2),
new Iso4217Definition("XAF", 950, 0),
new Iso4217Definition("XCD", 951, 2),
new Iso4217Definition("XOF", 952, 0),
new Iso4217Definition("XPF", 953, 0),
new Iso4217Definition("YER", 886, 2),
new Iso4217Definition("ZAR", 710, 2),
new Iso4217Definition("ZMW", 967, 2)
};
public static Iso4217Definition LookupByCode(string code)
{
return DefinitionCollection.SingleOrDefault(d => d.Code == code.ToUpper()) ?? Iso4217Definition.NotFound();
}
public static Iso4217Definition LookupByNumber(int number)
{
return DefinitionCollection.SingleOrDefault(d => d.Number == number) ?? Iso4217Definition.NotFound();
}
public class Iso4217Definition
{
private readonly string _code;
private readonly int _number;
private readonly int _exponent;
public bool Found { get; set; }
public string Code
{
get { return _code; }
}
public int Number
{
get { return _number; }
}
public int Exponent
{
get { return _exponent; }
}
private Iso4217Definition() {}
public Iso4217Definition(string code, int number, int exponent)
{
_code = code;
_number = number;
_exponent = exponent;
Found = true;
}
public static Iso4217Definition NotFound()
{
return new Iso4217Definition { Found = false };
}
}
}