I've been hunting a weird bug for a long time. I finally found it's cause.
I'm Danish, thus my .NET culture is "da-DK". In this culture "Gaard", doesn't start with "Ga" because it thinks that "aa" is "å" (in Danish it was before 1948).
That gives some unexpected results when doing prefix queries.
The solution is to add StringComparison.InvariantCulture in all StartsWith comparisons.
To verify my claim, try running:
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("da-DK");
|Field||Original Value||New Value|
|Summary||String.StartWith has culture in it.||String.StartsWith has culture in it.|
|Environment||.NET in (at least) da-DK culture||.NET under (at least) da-DK culture|
|Status||Open [ 1 ]||Closed [ 6 ]|
|Resolution||Won't Fix [ 2 ]|
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|21h 18m||1||Digy||29/May/11 20:38|