Feedback
Allow case-sensitive strings in HashSet and Dictionary
- Status
- Fixed
- Fixed in
- v26.8.6
- Source discussion
- https://forum.objo.dev/d/970-hashset-api-requests
- Last updated
- 2026-08-29
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
HashSet(Of String) and Dictionary(Of String, V) always compare strings case-insensitively, so a program cannot enforce exact-case uniqueness or look up exact-case keys. This request adds optional case-sensitive construction for both collections while keeping the existing case-insensitive behaviour as the default:
Var names As New HashSet(Of String) ' Case-insensitive (default)
Var exactNames As New HashSet(Of String)(True) ' Case-sensitive
Var values As New Dictionary(Of String, Integer) ' Case-insensitive (default)
Var exactValues As New Dictionary(Of String, Integer)(True) ' Case-sensitive
True selects ordinal case-sensitive equality and hashing for string items or keys. The mode is fixed at construction, affects only strings, and does not change Value.Equals() or any other language behaviour. Dictionary literals remain case-insensitive because they provide no comparison-mode syntax.