Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3332576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:42:10+00:00 2026-05-17T23:42:10+00:00

I have a question that’s so simple I cannot believe I can’t answer it

  • 0

I have a question that’s so simple I cannot believe I can’t answer it myself. But, there you go.

I have a large-ish static list (of cities, latitudes and longitudes) that I want to use in my Windows Phone 7 Silverlight application. There are around 10,000 of them. I’d like to embed this data statically in my application and access it in an array (I need to cycle through the whole list in code pretty regularly).

What is going to be my most effective means of storing this? I’m a bit of an old school sort, so I reckoned the fastest way to do it would be:

public struct City
{
    public string name;
    public double lat;
    public double lon;
};

and then…

private City[] cc = new City[10000];

public CityDists()
{
    cc[2].name = "Lae, Papua New Guinea"; cc[2].lat = 123; cc[2].lon = 123;
    cc[3].name = "Rabaul, Papua New Guinea"; cc[3].lat = 123; cc[3].lon = 123;
    cc[4].name = "Angmagssalik, Greenland"; cc[4].lat = 123; cc[4].lon = 123;
    cc[5].name = "Angissoq, Greenland"; cc[5].lat = 123; cc[5].lon = 123;
...

However, this bums out with an “out of memory” error before the code actually gets to run (I’m assuming the code itself ended up being too much to load into memory).

Everything I read online tells me to use an XML resource or file and then to deserialise that into instances of a class. But can that really be as fast as using a struct? Won’t the XML take ages to parse?

I think I’m capable of writing the code here – I’m just not sure what the best approach is to start with. I’m interested in speed of load and (more importantly) run time access more than anything.

Any help very much appreciated – first question here so I hope I haven’t done anything boneheaded.

Chris

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:42:11+00:00Added an answer on May 17, 2026 at 11:42 pm

    If loading an xml doc from the xap works for you..

    Here’s a project I posted demonstrating loading of an xml doc from the XAP via XDocument/LINQ and databinding to a listbox for reference.

    binding a Linq datasource to a listbox

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a question that I can't seem to find an answer for. I am
I am learning LINQ and have a very simple question that I think will
Question We have a large number of xml configuration files that we want merged
This is a (hopefully) really simple question - I have been told recently that
Question Is there a way to have a method that will always run anytime
I have a question that's not really a problem, but something that made me
I have a question that is similar, but not identical, to the one answered
Question: I have a question that is apparently not answered by this already-asked Bash
I have a question with fluent interfaces. We have some objects that are used
So I'm learning java, and I have a question. It seems that the types

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.