Example #1
0
 private void showInfoOfAddress(List <Address> addresses)
 {
     foreach (Address address in addresses)
     {
         showResult.Items.Add(address.ToString());
         XMLController.XmlSerrializer(addresses, "SearchResult.xml");
     }
 }
Example #2
0
        private void buttonSortByCountry_Click(object sender, EventArgs e)
        {
            showReadyAdresses.Items.Clear();
            var sortedList = from address in Address.getAddresses()
                             orderby address.getCountry()
                             select address;

            List <Address> result = new List <Address>();

            if (flag)
            {
                result.Clear();
                foreach (Address a in sortedList)
                {
                    result.Add(a);
                    showReadyAdresses.Items.Add(a.ToString());
                }

                XMLController.XmlSerrializer(result, "SortedAddressesByCountry.xml");

                flag = false;
            }
            else
            {
                result.Clear();
                foreach (Address a in sortedList.Reverse())
                {
                    result.Add(a);
                    showReadyAdresses.Items.Add(a.ToString());
                }
                result.Reverse();
                XMLController.XmlSerrializer(result, "SortedAddressesByCountry.xml");

                flag = true;
            }
        }