I am having List object. How can I dispose of the list?
For example,
List<User> usersCollection =new List<User>();
User user1 = new User();
User user2 = new User()
userCollection.Add(user1);
userCollection.Add(user2);
If I set userCollection = null;
what will happen?
foreach(User user in userCollection)
{
user = null;
}
Which one is best?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…