Console.WriteLine(typeof(string).IsClass); // true
It's a reference type.
It can't be a value-type, as value-types need a known size for the stack etc. As a reference-type, the size of the reference is known in advance, even if the size of the string isn't.
It behaves like you expect a value-type to behave because it is immutable; i.e. it doesn't* change once created. But there are lots of other immutable reference-types. Delegate instances, for example.
*=except for inside StringBuilder
, but you never see it while it is doing this...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…