How to generate a unique int from an arbitrary string?
I have strings of property names I am doing comparisons against, and realized ints would be much better to use for both performance and GC.
But I can't think of a good way to do it such that the same strings always generate the same ints, and that the ints are not duplicated, and is thread safe.
All I can think of is to just using a dictionary with a incremented int. Is there a better clever way of doin it?
But I can't think of a good way to do it such that the same strings always generate the same ints, and that the ints are not duplicated, and is thread safe.
All I can think of is to just using a dictionary with a incremented int. Is there a better clever way of doin it?