How to clear TreeInstance-list?

So I’m trying to do procedural generation with the terrain in Unity.
I do this by setting the heightmap and detailmap from noise-functions. It works fine.
I’ve now started to put out trees, but what I notice is that the trees are saved in the Treeinstances array after each session, and then duplicated when I start the game (in the editor) again.

Is there a way to clear the terrainData.Treeinstances list? The “.Clear()” method in System.collections.generic doesn’t work. So how would I go about to remove all elements?
(So that I can then put in new ones in run-time)

TerrainData.treeInstances is actually an array not a list. Try doing

using System;

Array.Clear(yourArray, 0, yourArray.Length);