private void WriteLocations() { PluginConfig cfg = new PluginConfig(); cfg.Regions = new WeatherRegionForecast[forecastRegions.Items.Count]; for (int i = 0; i < forecastRegions.Items.Count; i++) cfg.Regions[i] = (WeatherRegionForecast) forecastRegions.Items[i]; Helper.SerializeObject(WeatherPlugin.FORECASTS_XML, cfg, typeof(PluginConfig)); }