Allow using IEqualityComparer(Of T) in Select...Case-Statements
- Dominant language
- No language data
- Stars
- 328
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
If someone wants to match a string case-insensitive in a `Select`-Statement, he is more or less forced to convert the string to lower or upper case.
```
Select Case tagName.ToLower()
Case "a"
Case "p"
Case else
End Select
```
The .NET-Framework offers the` IEqualityComparer(Of T)`-Interface, and corresponding StringComparer-Implementations, to allow different types of equality checks.
It would be perfect, if we could use
```
Select Case tagName With StringComparer.OrdinalIgnoreCase
Case "a"
Case "p"
Case Else
End Select
```
A slightly more functional style would use a `Comparer(Of T)`-style method
```
Select Case tagName With Function(x,y) StringComparer.OrdinalIgnoreCase.Compare(x,y)
Case "a"
Case "p"
Case Else
End Select
```
alternatively expressed as
```
Select Case tagName With AddressOf StringComparer.OrdinalIgnoreCase.Compare
Case "a"
Case "p"
Case Else
End Select
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.