Click here to Skip to main content
15,911,890 members
Home / Discussions / C#
   

C#

 
GeneralRe: Storing Some settings in Registry Pin
Yaakov Davis19-Mar-05 10:20
Yaakov Davis19-Mar-05 10:20 
GeneralRe: Storing Some settings in Registry Pin
Luis Alonso Ramos19-Mar-05 22:32
Luis Alonso Ramos19-Mar-05 22:32 
GeneralSending files with data not compatable with a byte variable Pin
zaXch18-Mar-05 11:16
zaXch18-Mar-05 11:16 
GeneralRe: Sending files with data not compatable with a byte variable Pin
turbochimp18-Mar-05 12:47
turbochimp18-Mar-05 12:47 
GeneralRe: Sending files with data not compatable with a byte variable Pin
zaXch18-Mar-05 14:26
zaXch18-Mar-05 14:26 
GeneralRe: Sending files with data not compatable with a byte variable Pin
zaXch19-Mar-05 5:54
zaXch19-Mar-05 5:54 
Generalhelp with implementation Pin
John L. DeVito18-Mar-05 10:33
professionalJohn L. DeVito18-Mar-05 10:33 
GeneralRe: help with implementation Pin
turbochimp18-Mar-05 12:59
turbochimp18-Mar-05 12:59 
There are many ways you could go about this, and no way to cover all the bases in a practical reply.

If you're not tied to the existing file format, you might consider using XML. If you're not tied to using the file system, you might consider using a database, etc.

Assuming you want to stick with the current system, then you should probably use a FileStream and some flavor of StreamReader to read individual lines from the file (assuming logical records are separated by Newline characters), then you could use the String.Split(char) method to get a string array of the elements on each line, and go from there.

A couple of the benefits of using XML are flexibility and readability. You'd potentially have a little easier time changing the data you're storing, allowing for nulls or empty values or whatever.

You might also want to consider creating a structure or a class to hold the individual data elements that comprise a location (name, address etc.) - you'll probably want a class as the size of your type is likely to exceed 16 bytes (best practices limit on struct sizes since they're allocated on the stack), and you may also choose to investigate implementing your own custom collection of location objects (see CollectionBase for ideas).

Hope this is sufficient to get you started.

The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

Questionhow to customize a window Pin
Pikebu18-Mar-05 8:52
Pikebu18-Mar-05 8:52 
AnswerRe: how to customize a window Pin
Judah Gabriel Himango18-Mar-05 9:40
sponsorJudah Gabriel Himango18-Mar-05 9:40 
AnswerRe: how to customize a window Pin
MoustafaS18-Mar-05 12:26
MoustafaS18-Mar-05 12:26 
GeneralStatic Values Pin
MrEyes18-Mar-05 7:20
MrEyes18-Mar-05 7:20 
GeneralRe: Static Values Pin
Colin Angus Mackay18-Mar-05 7:27
Colin Angus Mackay18-Mar-05 7:27 
GeneralRe: Static Values Pin
Ravindra Sadaphule18-Mar-05 11:43
Ravindra Sadaphule18-Mar-05 11:43 
Generalmouse drag over problem Pin
ppp00118-Mar-05 5:11
ppp00118-Mar-05 5:11 
GeneralRe: mouse drag over problem Pin
Judah Gabriel Himango18-Mar-05 7:22
sponsorJudah Gabriel Himango18-Mar-05 7:22 
GeneralMemory optimisation Pin
PaleyX18-Mar-05 5:10
PaleyX18-Mar-05 5:10 
GeneralRe: Memory optimisation Pin
Andy Brummer18-Mar-05 5:46
sitebuilderAndy Brummer18-Mar-05 5:46 
GeneralRe: Memory optimisation Pin
ACorbs19-Mar-05 11:40
ACorbs19-Mar-05 11:40 
GeneralGacUtil and RegAsm Pin
ppp00118-Mar-05 4:57
ppp00118-Mar-05 4:57 
GeneralRe: GacUtil and RegAsm Pin
Judah Gabriel Himango18-Mar-05 5:28
sponsorJudah Gabriel Himango18-Mar-05 5:28 
GeneralRe: GacUtil and RegAsm Pin
Mike Dimmick18-Mar-05 8:57
Mike Dimmick18-Mar-05 8:57 
GeneralMac address Pin
Member 178719018-Mar-05 3:54
Member 178719018-Mar-05 3:54 
GeneralRe: Mac address Pin
felopater18-Mar-05 15:13
felopater18-Mar-05 15:13 
GeneralRe: Mac address Pin
afinnell20-Mar-05 17:02
afinnell20-Mar-05 17:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.