I have a few classes with heterogenous keys – int and string – and i want to work with them through common interface. It’s pretty simple just convert int to string but it obviously will cause perfomance issues. Another options I see are box them to “object”, which also doesn’t seems perfect, or somehow generate unique integers from string (there will be no joins between former “string” and “int” so they must be unique only in “string” domain) and the quetsion here is “how”?
Share
Just take
string.GetHashCode()which returns anintfrom astringwith very low collision probability.