基于防止字符串冗余分配内存的机制,CLR维护着一个叫驻留池(Intern Pool)的表。当声明一个字符串时,首先会到驻留池中检查是否已存在相同值时字符串,如果已存在则返回驻留池中的字符串,否则向驻留池中...
基于20个网页-相关网页
string intern pool 字符串拘留池机制
The CLR maintains a table called the intern pool that contains the literal strings in a program.
CLR维护一个名为“Intern pool”的表,该表包含程序中的文字字符串。
The System.String class provides an Intern method that ensures a string is in the intern pool and returns the reference to it.
String 类提供了 Intern 方法,以确保字符串位于“Intern pool”中,并且返回对它的引用。
应用推荐