if this is a project of enormous scale (e.g. millions of files), you might want to look into something like map reduce.
if not (which I'm guessing), I would suggest as follows:
parse each file sequentially, adding (appending)the results to each of TWO files. Finally, combine the two files and you're done.
LOCATIONS_FILE (FILE 1)
Location 1
Location 2
(etc)
METADATA_FILE (FILE 2)
location 1 params
location 2 params
(etc)
when all files are parsed, append the contents of FILE 2 to those of FILE 1.
FINAL FILE
Location 1
Location 2
(etc)
location 1 params
location 2 params
(etc)
I don't use VB.NET. But, pseudocode would be something like:
fn parse_file(file,locations_filehandle, metadata_filehandle):
file.extract_locations() -> append(locations_filehandle)
file.extract_metadata() -> append(metadata_filehandle)
fn main():
for file in files:
parse_file(file,locations_filehandle,metadata_filehandle)
finalfile=locations_filehandle.read() + metadata_filehandle.read()
finalfile.writeToDisk()
main()