D
David P. Donahue
I'm trying to come up with the best (fastest, as this code will be run
often) way to accomplish the following:
I have a dynamic string array X (as one grabbed from a GetFiles() or
GetDirectories() function call), which could have anywhere from 0 to
maybe 250 elements in it. I also have a statically-defined string array
Y which currently has 309 elements in it, but may grow over time. I
need to look through X and remove all elements that match any element in
Y. This can be accomplished through some nested loops and copying of
string arrays, but the inefficiency of that just doesn't sit right with me.
Is there anything in the .NET classes and functions that can make this
easier? Would it help if the arrays are known to be sorted? Does
anyone have any more creative algorithms that can do this quickly? Any
help would be much appreciated, thank you.
Regards,
David P. Donahue
(e-mail address removed)
often) way to accomplish the following:
I have a dynamic string array X (as one grabbed from a GetFiles() or
GetDirectories() function call), which could have anywhere from 0 to
maybe 250 elements in it. I also have a statically-defined string array
Y which currently has 309 elements in it, but may grow over time. I
need to look through X and remove all elements that match any element in
Y. This can be accomplished through some nested loops and copying of
string arrays, but the inefficiency of that just doesn't sit right with me.
Is there anything in the .NET classes and functions that can make this
easier? Would it help if the arrays are known to be sorted? Does
anyone have any more creative algorithms that can do this quickly? Any
help would be much appreciated, thank you.
Regards,
David P. Donahue
(e-mail address removed)