I need type parameter overloading as such:
Public Class Map(Of TKey, TValue)
Public Class Map(Of TKey As IEquatable(Of TKey), TValue)
so that i can New Map(Of Human) and the compiler will automatically match it to Public Class Map(Of TKey, TValue) and if i new Map(Of String) the compiler will automatically match it to Public Class Map(Of TKey As IEquatable(Of TKey), TValue) (since String is an IEquatable(Of String))
Right now my solution is to give the class different names as such:
Public Class Map(Of TKey, TValue)
Public Class EqMap(Of TKey As IEquatable(Of TKey), TValue)
But I’m looking for a better solution
Sorry I don’t speak VB… but in c# (which you have in your tags) what you want is
and
unfortunately this isn’t supported because constraints are not part of the signature you will have to provide different signatures and using different names (or possibly namespaces) is the cleanest solution IMO.