I would like to store world cities in a list since metro app can’t have local database but I am not sure it is possible (I’ve found a text file with more than 3 million cities).
I wonder how they did in the weather app. Since there is no latentcy in the results suggested (in the search charm or in the “favorite places” screen), I don’t think they use a webservice, and also I want my app to be able to propose a list of cities even if there is no connection available.
Any idea ?
Simply stick it in a text file, delimited by line. This is not a large amount of data – you can likely hold it all in RAM in one go.
Using a database just for this one list seems a little overkill.
With some rough calculations, assuming names of around 20 characters each, I’m in the region of about 100MB of city data. That’s not insignificant for one list in memory – granted, but it’s not a lot to have to contend with.
You may even be able to use something like a Linq to Text provider.
How they may have done it in the charm is to only worry about a few cities – the favourites and whatever your location service last reported. Handling < 10 is easier than 3 million.