Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Basically I want to develop a Address lookup(part of my project) using C# (and I can use SQL if necessary). I have a very large text file which have all the UK address and postcodes. Addresses needs to be looked up from this text file.

For example, as soon as a user type in the first letter of the postcode it should list all the postcodes starting with that letter and as they type in further, the list should narrow down.

Could you guys please how I can do this search very fast and list the results in a efficient way. If you guys know any methods and technologies pls do advice.

share|improve this question
I havent personally done this, but it looks like a trie is needed here, or something similar. – Karthik T Nov 28 '12 at 2:51
You should probably start by parsing the text file into a SQL database. – DC_ Nov 28 '12 at 4:21
The term you're looking for is Autocomplete. – Robert Harvey Nov 28 '12 at 7:34

For performance issues the first thing to do would be, importing the text files into a database.

On typing you can query the affected fields with "where Field LIKE 'input%' Order by xxx" and display the result.

Depending on the amount of Data you also could load all data to your local machine and apply filters on the displayed data.

share|improve this answer
Hitting the database on every keystroke is a poor idea. Its better to just load the data into memory for client side filtering, in my experience. – RubberDuck May 30 at 0:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.