Given
public IList<int> Numbers { get; } = []
What assumptions can I safely make about the type of Numbers
?
For example, will it always return false for IsFixedSize
and IsReadOnly
?
Obviously Array.Empty<int>()
also implements IList<int>
, but has a fixed size.
Right now, it seems to be a List<int>
. But what are the plans going forwards?
- Will the compiler analyse the code to determine whether the collection is ever added to or removed from?
- Or will the compiler always assume that IList is always expected to be mutable & non-fixed size?
Is there something in the docs that explains this?