Is this the preferred way to clear a list?
list = new List<>();
Is this the preferred way to clear a list?
list = new List<>();
You could do either this, or use List.Clear().
List.Clear () is what I’ve always used.
The list already exists, has space allocated and your simply removing references to any contents and GC will clear up if needed…unless I’m missing something.