Collection expressions ([...]) are designed to be a replacement for various collection creation patterns (like new T[] { ... } or new List<T> { ... }). A key capability is the ability to target core BCL (Base Class Library) interfaces directly.
When a collection expression is used where one of the following interface types is expected, the compiler must determine the most appropriate concrete implementation to instantiate:
IEnumerable<T>IReadOnlyCollection<T>IReadOnlyList<T>ICollection<T>IList<T>
This allows for highly permissive and idiomatic code, such as passing a collection expression directly to a method that accepts an interface, or initializing properties defined by interfaces.
// Passing a collection expression to a method accepting an interface
void DoSomething(IEnumerable<int> values) { ... }
DoSomething([1, 2, 3]);
// Initializing an interface property in a class
class Order
{
public IList<OrderId> ProductIds { get; } = [];
}