I'm curiuous why Expression-bodied properties doesn't create persisant objects.
public List<string> Pages { get; } = new List<string>();
Does create a persistant isntance of List<string>
, just like always.
But
public List<string> Pages => new List<string>();
Somehow this does craete a new instance, but seems to be volatile.
Even when adding a new string to Pages
won't add it.
There's no runtime- nor compile-time error, but I think there should be at least a warning. It took me quite a while to figure it out.
Is a bit odd documented.