I am trying to set XElements with an ArrayList and having a bit of trouble. I basically want to be able to do a foreach loop, but not sure where I need to insert it.
ArrayList cities = new ArrayList();
foreach (ListItem item in lstCities.Items)
{
cities.Add(item.Text);
}
new XElement("Cities", cities //not sure what to do here
.Select(x=>new XElement("City",x)))
This does not work, though it worked okay with this, but I want the city names, not array number
new XElement("Countries", lstCountry.GetSelectedIndices()
.Select(x => new XElement("Country", x))