Why can string that is a reference type be a non-null const while other reference type consts must be null?
c#
Solution
Taken from the const documentation:
A constant expression is an expression that can be fully evaluated at compile time. Therefore, the only possible values for constants of reference types are string and a null reference.
In other words, it's an exception. Life would be a whole lot more difficult if there weren't such things as string constants.
You can also remember that it's not all strings, for instance you can't compile with the code `const string test = new string('t', 7);`, even though you could with `static string test = new string('t', 7);`. On the other hand, while you can define a string constant as a string literal (`test = "value";`), you can't define any other reference types with a literal (`Form f = ???`).
Problem
As far as I know, `string` is a reference type. `const` can be used with `reference` type only if they are assigned `null`. My question is that why can `string` which is a reference type can be assigned a literal string (or non-null)?