How to get a free entry in a C# dictionary -
I am running a server, and I want a user dictionary, and give each user a specific number.
dictionary & lt; Int, serverside user & gt; Users = New Dictionary & lt; Int, ServerSideUser & gt; ();
The key represents the user on the server, so when people send messages to that user, they send them to this number. I may have used the user's IP number, but this is not a good idea.
I need to assign such a number to each user, and I'm not sure how to do this. Someone has given some suggestions like the
enumerable.ange (int.MinValue, int.MaxValue). (Select users. (X = & gt; x.Key)). first ();
But I do not think this is the optimal way. Besides, I have a problem with a list (or linkedlist) somewhere else.
Any thoughts?
If the size of "number" does not matter, take a guild, it is always unique and non Will be antithetic
Comments
Post a Comment