Hi guys, I need iterate a collection in Update(),I don’t care about the order,so I used HashSet to store them and use foreach loop to iterate them ,but I found that foreach has some GC problem ,so I wonder which collection is best practice in this case ?
void Update()
{
foreach (var ele in _curHashSet)
{
//do sth.....
}
}
and the reason I use HashSet is this collection will be Add and Remove frequently~