Why not EntityCollection display?

The antities in the EntityCollection is not display

// My code like this, it is not work, polyline did not display.
  let areaLineCollection = new Cesium.EntityCollection()
  
  let polyline = areaLineCollection.add(new Cesium.Entity({
    polyline : {
        width: 3,
        positions : Cesium.Cartesian3.fromDegreesArrayHeights(temp),
        material : Cesium.Color.YELLOW,
        depthFailMaterial : Cesium.Color.YELLOW,
        show: true
    }
  }));
  viewer.entities.add(areaLineCollection)

// I change my code to this, it works, the polyline display, I do not know why.

let polyline = viewer.entities.add(new Cesium.Entity({
    polyline : {
        width: 3,
        positions : Cesium.Cartesian3.fromDegreesArrayHeights(temp),
        material : Cesium.Color.YELLOW,
        depthFailMaterial : Cesium.Color.YELLOW,
        show: true
    }
  }));
  viewer.entities.add(areaLineCollection)

The EntityCollection can be used when creating custom data sources (see this example: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Custom%20DataSource.html)

If you’re just trying to keep track of groups of your entities, I would just add them to a regular JavaScript array. Does that work for you?