To add to what Gerry has - rightly - said, you can't assign a value to a
const
field unless it can be evaluated as a constant value at compile time. Since the
new
operator constructs an instance on the heap while your code is running, you cannot use that to assign a
const
value.
readonly
will do it, since it can only be assigned a value in the declaration line or in the containing class constructor:
readonly keyword - C# Reference | Microsoft Docs[
^]
The other solution is to create a property with either a
private
setter, or no setter at all and a constant value returned in the getter - but that's messy.