C
Chad Z. Hower aka Kudzu
I have a text file which is of the format:
01001=AGAWAM, MA
01002=CUSHMAN, MA
01005=BARRE, MA
01007=BELCHERTOWN, MA
01008=BLANDFORD, MA
01010=BRIMFIELD, MA
01011=CHESTER, MA
I need to load it into some class and access it by specifying the name (ie
01002) and so on. This is just for a demo - so I dont want to go over kill
with a DB or other. Just a simple solution.
In Delphi I can load this into a StringList easily:
FMyList.LoadFromFile(file name);
Then get values like this:
LCity := FMyList.Values['01002'];
I am hoping that I am just missing something but this appears to be a lot
more work to do in .Net.
NameObjectCollectionBase appears to be the best suited class. Is this
correct?
If so - how can I easily load the values from a file? It appears there is no
built in way? Is the only way to read the file and manually parse the
contents and add each pair myself?
01001=AGAWAM, MA
01002=CUSHMAN, MA
01005=BARRE, MA
01007=BELCHERTOWN, MA
01008=BLANDFORD, MA
01010=BRIMFIELD, MA
01011=CHESTER, MA
I need to load it into some class and access it by specifying the name (ie
01002) and so on. This is just for a demo - so I dont want to go over kill
with a DB or other. Just a simple solution.
In Delphi I can load this into a StringList easily:
FMyList.LoadFromFile(file name);
Then get values like this:
LCity := FMyList.Values['01002'];
I am hoping that I am just missing something but this appears to be a lot
more work to do in .Net.
NameObjectCollectionBase appears to be the best suited class. Is this
correct?
If so - how can I easily load the values from a file? It appears there is no
built in way? Is the only way to read the file and manually parse the
contents and add each pair myself?