- Home /
Question by
ina · Nov 11, 2014 at 10:24 PM ·
listgenericcollectionsgeneric list
Clear a generic list by replacing it with new list?
Is this the preferred way to clear a list?
list = new List<>();
Comment
Answer by TheSin · Nov 11, 2014 at 10:32 PM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220613171302im_/https://answers.unity.com/themes/thub/images/avi.jpg)