With My code I can Generate Lots of Places name from a Wikipedia article. Suppose if I look for Flensburg wikipedia page it will give all the external page links of places as name. So at this moment all the places are shown on output as list form like
Maasbüll
Bov Municipality
Hürup
Hürup(Amt)
Kupfermühle
.........and so on...
Now what I want to do is, I want to store all these places paired with its city name. Suppose here Flensburg is the city name. So i want to store it as following way-
Flensburg;Maasbüll;Bov Municipality;Hürup;Hürup(Amt);Kupfermühle.... so on..
My code to generate list of all places are as follows-
using (var client = new HttpClient())
{
var response = client.GetAsync("https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gspage=Flensburg&gslimit=500&gsprop=type|name|dim|country|region|globe&format=json").Result;
if (response.IsSuccessStatusCode)
{
var responseContent = response.Content;
string responseString = responseContent.ReadAsStringAsync().Result;
var obj = JsonConvert.DeserializeObject<RootObject>(responseString).query.geosearch.Select(a => a.title).ToList();
foreach (var item in obj)
{
Console.WriteLine(item);
}
}
}
I want to know how can I store my data like I mentioned.