Q:

How is the filter for a suggest dropdown list usually implemented?

When typing in an input box, it can be nice if there is a dropdown or section which shows a list of possible predictions.
What type of filter is used to generate these predictions?
Is it .Contains(string)(c#)? Is it .StartsWith(string)(c#)? Or should I just roll my own combination of those two and/or some other type?
My goal is to have an input box which will ajax post the text in an input box to a asp.net mvc 3 controller and get back a list of existing similar text.

A:

I would list the StartsWith results first (alphabetically), and below them, the Contains results (alphabetically, again).
For example:
Hello world
Foobar
Foobaz
Jon Skeet
AnotherFoo

Example:
Foo ▼

Foobar
Foobaz
AnotherFoo

