Open vthemelis opened 3 weeks ago
I think the best thing to do here might be something like
public static IEqualityComparer<string> DefaultFieldNameComparer = StringComparer.Ordinal;
and then change the instances of StringComparer.CurrentCulture
to be DefaultFieldNameComparer
. This will give a better default while still letting users revert to the previous behavior globally simply by assigning a different value to the static field.
I think the best thing to do here might be something like
public static IEqualityComparer<string> DefaultFieldNameComparer = StringComparer.Ordinal;
and then change the instances of
StringComparer.CurrentCulture
to beDefaultFieldNameComparer
. This will give a better default while still letting users revert to the previous behavior globally simply by assigning a different value to the static field.
Sounds like a good idea but it could invalidate existing lookups or necessitate reindexing lookups on reassignment of its value. What are your thoughts on this?
It seems reasonable to expect that users should only set this once on their application startup, before any indexes are created. Maybe a comment warning about the problems that misuse could cause in a public documentation comment would be worthwhile.
In the Schema class, there are three methods used to retrieve individual fields:
The first method (GetFieldByName) use the default string comparer, while the latter two (GetFieldIndex overloads) are using a culture aware comparator by default (
StringComparer.CurrentCulture
). This inconsistency can be confusing, as it is unclear when custom comparers are utilized.Component(s)
C#