I have a list of strings and need to find which strings match a given input value.
what is the most efficient way (memory vs execution speed) for me to store this list of strings and be able to search through it? The start-up and loading of the list of strings isnt important, but the response time for searching is.
should i be using a List or HashSet or just a basic string[] or something else?
It depends very much on the nature of the strings and the size of the collection. Depending on characteristics of the collection, and the expected search strings, there are ways to organize things very cleverly so that searching is very fast. You haven’t given us that information.
But here’s what I’d do. I’d set a reasonable performance requirement. Then I’d try a n-gram index (why? because you said in a comment you need to account for partial matches; a
HashSet<string>won’t help you here) and I’d profile reasonable inputs that I expect against this solution and see if it meets my performance requirements or not. If it does, I’d accept the solution and move on. If it doesn’t, I’d think very carefully about whether or not my performance requirements are reasonable. If they are, I’d start thinking about whether or not there is something special about my inputs and collection that might enable me to use some more clever solutions.