As Dave says,
const
values are constants, and only primitive types can be expressed as a constant literal at compile time.
However, there is
readonly
which is the
struct
/
class
equivelant - a value that can only be set in an instance constructor or as part of the declaration:
readonly keyword - C# Reference | Microsoft Docs[
^]
However, a
readonly
reference type is not immutable (unlike a
const
or a
readonly struct
which is). The reference variable can't be changed, but the values in the reference object instance can.