Пример #1
0
 public static INonEmptyEnumerable <T> Concat <T>(this T value, IEnumerable <T> others)
 {
     return(NonEmptyEnumerable.Create(value, others));
 }
Пример #2
0
        static Countries()
        {
            All = NonEmptyEnumerable.Create(
                AalandIslands               = NonEuropean("AX"),
                Afghanistan                 = NonEuropean("AF"),
                Albania                     = NonEuropean("AL"),
                Algeria                     = NonEuropean("DZ"),
                AmericanSamoa               = NonEuropean("AS"),
                Andorra                     = NonEuropean("AD"),
                Angola                      = NonEuropean("AO"),
                Anguilla                    = NonEuropean("AI"),
                Antarctica                  = NonEuropean("AQ"),
                AntiguaAndBarbuda           = NonEuropean("AG"),
                Argentina                   = NonEuropean("AR"),
                Armenia                     = NonEuropean("AM"),
                Aruba                       = NonEuropean("AW"),
                Australia                   = NonEuropean("AU"),
                Austria                     = European("AT", "^(AT)?U[0-9]{8}$"),
                Azerbaijan                  = NonEuropean("AZ"),
                Bahamas                     = NonEuropean("BS"),
                Bahrain                     = NonEuropean("BH"),
                Bangladesh                  = NonEuropean("BD"),
                Barbados                    = NonEuropean("BB"),
                Belarus                     = NonEuropean("BY"),
                Belgium                     = European("BE", "^(BE)?0[0-9]{9}$"),
                Belize                      = NonEuropean("BZ"),
                Benin                       = NonEuropean("BJ"),
                Bermuda                     = NonEuropean("BM"),
                Bhutan                      = NonEuropean("BT"),
                Bolivia                     = NonEuropean("BO"),
                BonaireSintEustatiusAndSaba = NonEuropean("BQ"),
                BosniaAndHerzegovina        = NonEuropean("BA"),
                Botswana                    = NonEuropean("BW"),
                BouvetIsland                = NonEuropean("BV"),
                Brazil                      = NonEuropean("BR"),
                BritishIndianOceanTerritory = NonEuropean("IO"),
                BruneiDarussalam            = NonEuropean("BN"),
                Bulgaria                    = European("BG", "^(BG)?[0-9]{9,10}$"),
                BurkinaFaso                 = NonEuropean("BF"),
                Burundi                     = NonEuropean("BI"),
                CaboVerde                   = NonEuropean("CV"),
                Cambodia                    = NonEuropean("KH"),
                Cameroon                    = NonEuropean("CM"),
                Canada                      = NonEuropean("CA"),
                CaymanIslands               = NonEuropean("KY"),
                CentralAfricanRepublic      = NonEuropean("CF"),
                Chad                             = NonEuropean("TD"),
                Chile                            = NonEuropean("CL"),
                China                            = NonEuropean("CN"),
                ChristmasIsland                  = NonEuropean("CX"),
                CocosIslands                     = NonEuropean("CC"),
                Colombia                         = NonEuropean("CO"),
                Comoros                          = NonEuropean("KM"),
                Congo                            = NonEuropean("CG"),
                CongoDemocraticRepublic          = NonEuropean("CD"),
                CookIslands                      = NonEuropean("CK"),
                CostaRica                        = NonEuropean("CR"),
                CoteIvoire                       = NonEuropean("CI"),
                Croatia                          = NonEuropean("HR"),
                Cuba                             = NonEuropean("CU"),
                Curacao                          = NonEuropean("CW"),
                Cyprus                           = European("CY", "^(CY)?[0-9]{8}L$"),
                CzechRepublic                    = European("CZ", "^(CZ)?[0-9]{8,10}$"),
                Denmark                          = European("DK", "^(DK)?[0-9]{8}$"),
                Djibouti                         = NonEuropean("DJ"),
                Dominica                         = NonEuropean("DM"),
                DominicanRepublic                = NonEuropean("DO"),
                Ecuador                          = NonEuropean("EC"),
                Egypt                            = NonEuropean("EG"),
                ElSalvador                       = NonEuropean("SV"),
                EquatorialGuinea                 = NonEuropean("GQ"),
                Eritrea                          = NonEuropean("ER"),
                Estonia                          = European("EE", "^(EE)?[0-9]{9}$"),
                Ethiopia                         = NonEuropean("ET"),
                FalklandIslands                  = NonEuropean("FK"),
                FaroeIslands                     = NonEuropean("FO"),
                Fiji                             = NonEuropean("FJ"),
                Finland                          = European("FI", "^(FI)?[0-9]{8}$"),
                France                           = European("FR", "^(FR)?[0-9A-Z]{2}[0-9]{9}$"),
                FrenchGuiana                     = NonEuropean("GF"),
                FrenchPolynesia                  = NonEuropean("PF"),
                FrenchSouthernTerritories        = NonEuropean("TF"),
                Gabon                            = NonEuropean("GA"),
                Gambia                           = NonEuropean("GM"),
                Georgia                          = NonEuropean("GE"),
                Germany                          = European("DE", "^(DE)?[0-9]{9}$"),
                Ghana                            = NonEuropean("GH"),
                Gibraltar                        = NonEuropean("GI"),
                Greece                           = European("GR", "^(EL|GR)?[0-9]{9}$"),
                Greenland                        = NonEuropean("GL"),
                Grenada                          = NonEuropean("GD"),
                Guadeloupe                       = NonEuropean("GP"),
                Guam                             = NonEuropean("GU"),
                Guatemala                        = NonEuropean("GT"),
                Guernsey                         = NonEuropean("GG"),
                Guinea                           = NonEuropean("GN"),
                GuineaBissau                     = NonEuropean("GW"),
                Guyana                           = NonEuropean("GY"),
                Haiti                            = NonEuropean("HT"),
                HeardIslandAndMcDonaldIslands    = NonEuropean("HM"),
                HolySee                          = NonEuropean("VA"),
                Honduras                         = NonEuropean("HN"),
                HongKong                         = NonEuropean("HK"),
                Hungary                          = European("HU", "^(HU)?[0-9]{8}$"),
                Iceland                          = NonEuropean("IS"),
                India                            = NonEuropean("IN"),
                Indonesia                        = NonEuropean("ID"),
                Iran                             = NonEuropean("IR"),
                Iraq                             = NonEuropean("IQ"),
                Ireland                          = European("IE", "^(IE)?[0-9][0-9A-Z\\+\\*][0-9]{5}L$"),
                IsleOfMan                        = NonEuropean("IM"),
                Israel                           = NonEuropean("IL"),
                Italy                            = European("IT", "^(IT)?[0-9]{11}$"),
                Jamaica                          = NonEuropean("JM"),
                Japan                            = NonEuropean("JP"),
                Jersey                           = NonEuropean("JE"),
                Jordan                           = NonEuropean("JO"),
                Kazakhstan                       = NonEuropean("KZ"),
                Kenya                            = NonEuropean("KE"),
                Kiribati                         = NonEuropean("KI"),
                KoreaDemocraticPeoplesRepublic   = NonEuropean("KP"),
                KoreaRepublic                    = NonEuropean("KR"),
                Kosovo                           = NonEuropean("XK"),
                Kuwait                           = NonEuropean("KW"),
                Kyrgyzstan                       = NonEuropean("KG"),
                LaoPeoplesDemocraticRepublic     = NonEuropean("LA"),
                Latvia                           = European("LV", "^(LV)?[0-9]{11}$"),
                Lebanon                          = NonEuropean("LB"),
                Lesotho                          = NonEuropean("LS"),
                Liberia                          = NonEuropean("LR"),
                Libya                            = NonEuropean("LY"),
                Liechtenstein                    = NonEuropean("LI"),
                Lithuania                        = European("LT", "^(LT)?([0-9]{9}|[0-9]{12})$"),
                Luxembourg                       = European("LU", "^(LU)?[0-9]{8}$"),
                Macao                            = NonEuropean("MO"),
                Macedonia                        = NonEuropean("MK"),
                Madagascar                       = NonEuropean("MG"),
                Malawi                           = NonEuropean("MW"),
                Malaysia                         = NonEuropean("MY"),
                Maldives                         = NonEuropean("MV"),
                Mali                             = NonEuropean("ML"),
                Malta                            = European("MT", "^(MT)?[0-9]{8}$"),
                MarshallIslands                  = NonEuropean("MH"),
                Martinique                       = NonEuropean("MQ"),
                Mauritania                       = NonEuropean("MR"),
                Mauritius                        = NonEuropean("MU"),
                Mayotte                          = NonEuropean("YT"),
                Mexico                           = NonEuropean("MX"),
                Micronesia                       = NonEuropean("FM"),
                Moldova                          = NonEuropean("MD"),
                Monaco                           = NonEuropean("MC"),
                Mongolia                         = NonEuropean("MN"),
                Montenegro                       = NonEuropean("ME"),
                Montserrat                       = NonEuropean("MS"),
                Morocco                          = NonEuropean("MA"),
                Mozambique                       = NonEuropean("MZ"),
                Myanmar                          = NonEuropean("MM"),
                Namibia                          = NonEuropean("NA"),
                Nauru                            = NonEuropean("NR"),
                Nepal                            = NonEuropean("NP"),
                Netherlands                      = European("NL", "^(NL)?[0-9]{9}B[0-9]{2}$"),
                NewCaledonia                     = NonEuropean("NC"),
                NewZealand                       = NonEuropean("NZ"),
                Nicaragua                        = NonEuropean("NI"),
                Niger                            = NonEuropean("NE"),
                Nigeria                          = NonEuropean("NG"),
                Niue                             = NonEuropean("NU"),
                NorfolkIsland                    = NonEuropean("NF"),
                NorthernMarianaIslands           = NonEuropean("MP"),
                Norway                           = NonEuropean("NO"),
                Oman                             = NonEuropean("OM"),
                Pakistan                         = NonEuropean("PK"),
                Palau                            = NonEuropean("PW"),
                Palestine                        = NonEuropean("PS"),
                Panama                           = NonEuropean("PA"),
                PapuaNewGuinea                   = NonEuropean("PG"),
                Paraguay                         = NonEuropean("PY"),
                Peru                             = NonEuropean("PE"),
                Philippines                      = NonEuropean("PH"),
                Pitcairn                         = NonEuropean("PN"),
                Poland                           = European("PL", "^(PL)?[0-9]{10}$"),
                Portugal                         = European("PT", "^(PT)?[0-9]{9}$"),
                PuertoRico                       = NonEuropean("PR"),
                Qatar                            = NonEuropean("QA"),
                Romania                          = European("RO", "^(RO)?[0-9]{2,10}$"),
                Runion                           = NonEuropean("RE"),
                RussianFederation                = NonEuropean("RU"),
                Rwanda                           = NonEuropean("RW"),
                SaintBarthélemy                  = NonEuropean("BL"),
                SaintHelena                      = NonEuropean("SH"),
                SaintKittsAndNevis               = NonEuropean("KN"),
                SaintLucia                       = NonEuropean("LC"),
                SaintMartin                      = NonEuropean("MF"),
                SaintPierreAndMiquelon           = NonEuropean("PM"),
                SaintVincentAndTheGrenadines     = NonEuropean("VC"),
                Samoa                            = NonEuropean("WS"),
                SanMarino                        = NonEuropean("SM"),
                SaoTomeAndPrincipe               = NonEuropean("ST"),
                SaudiArabia                      = NonEuropean("SA"),
                Senegal                          = NonEuropean("SN"),
                Serbia                           = NonEuropean("RS"),
                Seychelles                       = NonEuropean("SC"),
                SierraLeone                      = NonEuropean("SL"),
                Singapore                        = NonEuropean("SG"),
                SintMaarten                      = NonEuropean("SX"),
                Slovakia                         = European("SK", "^(SK)?[0-9]{10}$"),
                Slovenia                         = European("SI", "^(SI)?[0-9]{8}$"),
                SolomonIslands                   = NonEuropean("SB"),
                Somalia                          = NonEuropean("SO"),
                SouthAfrica                      = NonEuropean("ZA"),
                SouthGeorgia                     = NonEuropean("GS"),
                SouthSudan                       = NonEuropean("SS"),
                Spain                            = European("ES", "^(ES)?[0-9A-Z][0-9]{7}[0-9A-Z]$"),
                SriLanka                         = NonEuropean("LK"),
                Sudan                            = NonEuropean("SD"),
                Suriname                         = NonEuropean("SR"),
                SvalbardAndJanMayen              = NonEuropean("SJ"),
                Swaziland                        = NonEuropean("SZ"),
                Sweden                           = European("SE", "^(SE)?[0-9]{12}$"),
                Switzerland                      = NonEuropean("CH"),
                SyrianArabRepublic               = NonEuropean("SY"),
                Taiwan                           = NonEuropean("TW"),
                Tajikistan                       = NonEuropean("TJ"),
                Tanzania                         = NonEuropean("TZ"),
                Thailand                         = NonEuropean("TH"),
                TimorLeste                       = NonEuropean("TL"),
                Togo                             = NonEuropean("TG"),
                Tokelau                          = NonEuropean("TK"),
                Tonga                            = NonEuropean("TO"),
                TrinidadAndTobago                = NonEuropean("TT"),
                Tunisia                          = NonEuropean("TN"),
                Turkey                           = NonEuropean("TR"),
                Turkmenistan                     = NonEuropean("TM"),
                TurksAndCaicosIslands            = NonEuropean("TC"),
                Tuvalu                           = NonEuropean("TV"),
                Uganda                           = NonEuropean("UG"),
                Ukraine                          = NonEuropean("UA"),
                UnitedArabEmirates               = NonEuropean("AE"),
                UnitedKingdom                    = European("GB", "^(GB)?([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})$"),
                UnitedStatesMinorOutlyingIslands = NonEuropean("UM"),
                UnitedStatesOfAmerica            = NonEuropean("US"),
                Uruguay                          = NonEuropean("UY"),
                Uzbekistan                       = NonEuropean("UZ"),
                Vanuatu                          = NonEuropean("VU"),
                Venezuela                        = NonEuropean("VE"),
                Vietnam                          = NonEuropean("VN"),
                VirginIslandsBritish             = NonEuropean("VG"),
                VirginIslandsUS                  = NonEuropean("VI"),
                WallisAndFutuna                  = NonEuropean("WF"),
                WesternSahara                    = NonEuropean("EH"),
                Yemen                            = NonEuropean("YE"),
                Zambia                           = NonEuropean("ZM"),
                Zimbabwe                         = NonEuropean("ZW")
                ).ToList();

            AllByCodes           = All.ToDictionary(c => c.Alpha2Code);
            EuropeanUnionByCodes = All.Select(c => c.First).Flatten().ToDictionary(c => c.Alpha2Code);
        }
Пример #3
0
 public static INonEmptyEnumerable <T> ToEnumerable <T>(this T value)
 {
     return(NonEmptyEnumerable.Create(value));
 }
Пример #4
0
 public static IOption <INonEmptyEnumerable <T> > AsNonEmpty <T>(this IEnumerable <T> source)
 {
     return(NonEmptyEnumerable.Create(source));
 }