private void WriteToFileCountries(string path, IEnumerable <JsonCountryReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonCountryReportModel { Country = rep.Country, Region = rep.Region }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.Country + ".json")) { sw.WriteLine(json); } } }
private void WriteToFileCountries(string path, IEnumerable<JsonCountryReportModel> reportCollection) { foreach (var rep in reportCollection) { var data = new JsonCountryReportModel { Country = rep.Country, Region = rep.Region }; string json = JsonConvert.SerializeObject(data, Formatting.Indented); using (StreamWriter sw = new StreamWriter(path + rep.Country + ".json")) { sw.WriteLine(json); } } }