3
Answers

How to dispose List


Hi experts,

I am having List<User> object. How I can dispose 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?




Answers (3)
Next Recommended Forum