Quote:
|
Is it ok like this, or is it really really bad?
|
Imho, its really bad practice. Why would a class contain Objects of itself? Create a class called Userbase or so which holds user and information about them.
Another thing i noticed:
Quote:
int uid = new Random().Next(500);
foreach (User u in users)
if (u.UserID == uid)
uid = new Random().Next(500);
|
uid should be a unique identifier? Its not guaranteed to be unique when doing it like this.
Example:
user1 id: 15
user2 id: 12
user3 id: 19
user4 id: 07
first generated uid = 12
iterating over list:
compate with uid of first user -> ok
compate with uid of second user -> match -> not ok!
new generated uid = 15
compare with uid of third user -> ok
compare with uid of 4th user -> ok
-> everything seems fine, but uid of user1 equals the newly generated uid.