M
^MisterJingo^
I'm working on a project which contains a web interface file browser.
Currently the files can be hidden or shown (based upon file name or
extension type) through a hardcoded series of 'if' and 'switch'
statements.
I'm moving this over to an xml file which will be cached and loaded at
application start and have come up with two possible ways of doing
this:
a) Load the file into a datatable and then for each file object found
in a directory, loop through the datatable to see if that file should
be shown or hidden.
b) create a value object dictionary with the key being the file or
extension name and then a struct, containing things like image (to
attach to file type) and alt/title text (for the image etc), being
stored along with the key. Then simply feeding each name of file
object into the Dictionary and pulling out the corresponding struct
and relevant information.
Which of these would be best performance wise? The first would
generate large amounts of looping, and the second would perhaps have a
performance hit from converting the objects in the dictionary back to
structs.
Or is there a better way of doing this?
Currently the files can be hidden or shown (based upon file name or
extension type) through a hardcoded series of 'if' and 'switch'
statements.
I'm moving this over to an xml file which will be cached and loaded at
application start and have come up with two possible ways of doing
this:
a) Load the file into a datatable and then for each file object found
in a directory, loop through the datatable to see if that file should
be shown or hidden.
b) create a value object dictionary with the key being the file or
extension name and then a struct, containing things like image (to
attach to file type) and alt/title text (for the image etc), being
stored along with the key. Then simply feeding each name of file
object into the Dictionary and pulling out the corresponding struct
and relevant information.
Which of these would be best performance wise? The first would
generate large amounts of looping, and the second would perhaps have a
performance hit from converting the objects in the dictionary back to
structs.
Or is there a better way of doing this?