asp.net.ph

String.IsInterned Method

System Namespace   String Class


Retrieves a reference to a specified String.

[ VB ]
<Serializable>
Public Shared Function IsInterned ( _
   ByVal str As String _
) As String

[ C# ]
[ Serializable ]
public static string IsInterned (
   string str
);

[ C++ ]
[ Serializable ]
public: static String* IsInterned (
   String* str
);

[ JScript ]
public Serializable
static function IsInterned (
   str : String
) : String;

Parameters

str
A String.

Return Value

A String reference to str if it is in the common language runtime "intern pool"; otherwise a null reference ( Nothing in Visual Basic ).

Exceptions


Exception Type Condition
ArgumentNullException str is a null reference ( Nothing in Visual Basic ).

Remarks

The common language runtime automatically maintains a table, called the "intern pool", which contains a single instance of each unique literal string constant declared in a program, as well as any unique instance of String you add programmatically.

The intern pool conserves string storage. If you assign a literal string constant to several variables, each variable is set to reference the same constant in the intern pool instead of referencing several different instances of String that have identical values.

This method looks up str in the intern pool. If str has already been interned, a reference to that instance is returned; otherwise, a null reference ( Nothing in Visual Basic ) is returned.

Compare this method to the Intern method.

This method does not return a Boolean value, but can still be used where a Boolean is needed.

See Also

String Members   Intern Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph