Exemple #1
0
        public CityCollection()
        {
            Cities = new List <City>();
            DistrictCollection districtCollection = new DistrictCollection();

            this.Cities.Add(new City(111, "Витебск", districtCollection.Districts.Find(d => d.DistrictCode == 11)));
            this.Cities.Add(new City(112, "Брест", districtCollection.Districts.Find(d => d.DistrictCode == 11)));
            this.Cities.Add(new City(311, "Сидней", districtCollection.Districts.Find(d => d.DistrictCode == 31)));
            this.Cities.Add(new City(411, "Мельбурн", districtCollection.Districts.Find(d => d.DistrictCode == 41)));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            List <Country>      cc  = new CountryCollection().Countries;
            List <District>     dc  = new DistrictCollection().Districts;
            List <City>         ctc = new CityCollection().Cities;
            List <Neighborhood> nbc = new NeighborhoodCollection().Neighborhoods;

            var results = from country in cc
                          join d in dc on country.CountryCode equals d.Country.CountryCode
                          join ct in ctc on d.DistrictCode equals ct.District.DistrictCode
                          join nb in nbc on ct.CityCode equals nb.City.CityCode
                          select new { nb.StreetName };

            foreach (var result in results)
            {
                Console.WriteLine($"street: {result.StreetName}");
            }
            Console.ReadKey();
        }