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.

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

1 Answer 1


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.

  • 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
    Commented May 30, 2016 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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