I am curious why System.String is sealed?
I know that I can do everything I need to not inherit it, but still - why?
There are many classes that, by their nature, are strings that have specific methods and properties. These are identifiers, emails, names, etc.
Object-oriented design offers encapsulating functionality in a particular class. And here we have a strange situation when the most useful fundamental type in the most popular object structure does not expand.
Thank.
The editors.
Commentary on immutability. It's easy to hide all state-related stuff in private methods and allow child classes to have read-only access to class data.
class String
{
private byte[] state;
private void EditState(byte[]) {}
protected byte getReadOnlyData() {}
protected virtual getHashCode() {}
protected virtual xxx() {}
}
. , ASIN, IMEI .., , , . , - - - ..
, , , .