No, Convert.ToInt32(text)
will just try to parse your text to an int
, like:
Convert.ToInt32("032")
will return 32
as int
but
Convert.ToInt32("Brian")
will throw an exception.
I assume that you want to have some kind of hashing, when you say “different words to the same int”.
Try GetHashCode()
. It will return the same value if you call it multiple times with the same value, for example:
"Brian".GetHashCode()
will always return 1635321435
1
solved Convert.ToInt32(“example”) Collisions? [closed]