문자열 다룰 때 Globalization 고려해야 한다면 아래의 사항을 조심.
- Make sure that all string comparisons use an explicit overload that takes a StringComparison object.
- Use StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase when comparing strings in a culture-agnostic way.
- Use StringComparison.CurrentCulture when displaying text to the user.
- Make sure that all persisted text is persisted with the invariant culture.
- Make sure that you are not using String.Compareor CompareTofor equality testing.
- Implement IFormattablefor custom types that are displayed to the user to make sure that all culture settings are respected.
- Use the correct format strings when displaying numbers, dates, and times to the user.
댓글
댓글 쓰기