Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# c货币组合框_C# - Fatal编程技术网

C# c货币组合框

C# c货币组合框,c#,C#,我想为我的应用程序创建一个货币组合框下拉列表控件,并假设货币作为属性存在于RegionInfo对象中,如果有人能巧妙地将它们放入数组中,我就会漫游 干杯 理查德像这样: CultureInfo.GetCultures(CultureTypes.SpecificCultures) .Select(c => new RegionInfo(c.LCID).CurrencySymbol) .Distinct() 在我的Windows7机器上,这会产生

我想为我的应用程序创建一个货币组合框下拉列表控件,并假设货币作为属性存在于RegionInfo对象中,如果有人能巧妙地将它们放入数组中,我就会漫游

干杯

理查德像这样:

CultureInfo.GetCultures(CultureTypes.SpecificCultures)
           .Select(c => new RegionInfo(c.LCID).CurrencySymbol)
           .Distinct()
在我的Windows7机器上,这会产生

ر.س.‏ лв. € NT$ Kč kr. $ ₪ Ft ¥ ₩ kr zł R$ fr. lei р. kn Lek ฿ TL Rs Rp ₴ Ls Lt т.р. ريال ₫ դր. man. ден. R Lari रु RM Т сом S m. so'm টা ਰੁ રૂ ଟ ரூ రూ ರೂ ക ট ₮ £ ៛ ₭ ل.س.‏ රු. ETB ؋ PhP ރ. N $b һ. с. Q RWF XOF د.ع.‏ Fr. Din. ман. сўм ৳ DZD ج.م.‏ HK$ Дин. S/. د.ل.‏ KM د.ج.‏ MOP CHF ₡ د.م.‏ B/. د.ت.‏ RD$ КМ ر.ع.‏ J$ Bs. F. ر.ي.‏ BZ$ د.ا.‏ TT$ ل.ل.‏ Z$ د.ك.‏ Php د.إ.‏ $U د.ب.‏ Gs ر.ق.‏ Rs. L. C$
对于我们这些在.NET 2上没有选择内部数组的人来说,下面是SLak的精彩答案:

现在使用GetDistinctValue from,因为在.NET3.5中没有明确的定义

        CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
        List<string> CountryCodes = new List<string>();
        foreach (CultureInfo ci in cultures)
        {
            RegionInfo ri = new RegionInfo(ci.LCID);
            CountryCodes.Add(ri.ISOCurrencySymbol);
        }
        string [] CountryCodeArray = GetDistinctValues(CountryCodes.ToArray());

public string[] GetDistinctValues(string[] array)
{
    List<string> list = new List<string>();

    for (int i = 0; i < array.Length; i++)
    {
        if (list.Contains(array[i]))
            continue;
        list.Add(array[i]);
    }
    return list.ToArray();
}
您可以调用Array.ConvertAll。另外,Distinct是.NET3.5的新功能。