[Mono-devel-list] System.String::Intern()

Varga Zoltan vargaz at freemail.hu
Sun Sep 14 08:28:31 EDT 2003


                                                 Hi,

  Only the literal strings in the assembly are put into the
intern pool,
so 

String.Intern ("A") 

will return the same string, while

string foo = "A";
string bar = "B";

String.Intern (foo + bar)

will return a new interned string

            bye

                   Zoltan




Chris Seaton <chris at chrisseaton.com> írta:

> The System.String::Intern() method confuses me so much my
brain hurts.
> This function gets a reference to a string in the intern
pool. All
> unique strings exist once in the intern pool, saving
memory. However, to
> call the Intern function, one of the parameters is a
string, and because
> all strings are in the intern pool, the parameter must be
in the intern
> pool, so what is the point in calling the function?
> -- 
> Chris Seaton
> 
> chris at chrisseaton.com
> http://www.chrisseaton.com/
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 





More information about the Mono-devel-list mailing list