Surprisingly, String.Clone()
doesn\'t return a copy of a string as String.Copy()
would do. Instead, it returns \'this\'
, the original stri
IClonable is somewhat deprecated as it's unclear what "Clone" means from a system-wide standpoint (deep, shallow...). See http://blogs.msdn.com/b/brada/archive/2003/04/09/49935.aspx
The reference source documents the Clone method with the following comment:
// There's no point in cloning a string since they're immutable, so we simply return this.
Interning of strings means that it's hard to collect strings (they can be referenced more than once) which means really making a new copy of string serves only to stress the system. Plus, interning and copying conflict with each other--so the general rule of interning wins.