views:

292

answers:

3

Hey guys,

I am making a small project for myself that deals with gps and some other cool stuff on WM6 in C#. I am just wondering, is it better to read from a file when you need to access the data or is it better to just read the whole file into the program and deal with it then? Mainly, I am talking about locations that I will save within some type of file/database, not quite sure which one yet. These locations will need to be looped over frequently and that's why I think I should read the whole file in and then write back to it later, but how much data becomes too much? Are there any efficiency issues that could arise from reading in lots of data from a file opposed to the obvious efficiency issues from reading the next value from a file as needed? It doesn't really make too much difference at this stage since I will probably never get lots and lots of data, but it is good to think about scalability at some stage I suppose.

Cheers

A: 

I would recommend some sort of database. No matter what the platform, it just makes things easier.

I can look into SQL Server Compact or Windows Mobile EDB database api. The SQL Server Compact is most likely to be easier to use in C#.

Shane Powell
+2  A: 

Shane is right on the mark, store the data in a SQLCE database and use paramatized querys to access what you need from there.

As for memory usage, WM6 (and 6.5) is based on WinCE 5.something

WinCE 5.* has this annoying design where there is no concept of virtual memory, memory is split up into 32mb slots and applications are only allocated a single slot - in effect your application can only use 32mb of memory. Sure there are hacks out there to get around this but this is still a fundamental limit.

You really dont need to be too concerned about using too much memory - always call dispose, only keep around what you need to keep around, and learning how to use '.NETCF Remote Performance Monitor' which has saved my a$$ on ocassion.

Steven H
Thanks for the suggestions guys :)
For the record, CE 5.0 (and WinMo 5) certainly do have virtual memory. And the GC Heap is in shared memory outside the 32MB process space, so the 32MB limit actually has no effect on memory controlled by the GC heap. The place it hurts is in native resource allocations (like Bitmaps).
ctacke
A: 

as well as the other suggestions is db4Objects it has a lightweight compact framework version (just download the .NET version and you also get a compact framework version).

Tim Jarvis