Home » C# String IsInterned() method

C# String IsInterned() method

by Online Tutorials Library

C# String IsInterned()

The C# IsInterned() method is used to get reference of the specified string.

The difference between Intern() and IsInterned() is that Intern() method interns the string if it is not interned but IsInterned() doesn’t do so. In such case, IsInterned() method returns null.

Signature

Parameter

str: it is a string type parameter.

Return

It returns a reference.


C# String IsInterned() Method Example

Output:

Hello C# Hello C# Hello C# 

C# String Intern() vs IsInterned() Example

Output:

True False 

You may also like