find and solve ||
Please wait.....

C# String Intern()

In the c# String Intern() method is used to retrieve reference to the specified String that mean optimizes string memory and performance and It allows us to put strings in the runtime's shared string pool.


public static string Intern(String str)  


str: it is a parameter of type string.

C# String Intern() Method Example

using System;
public class Program
  public static void Main()
           string str = "Hello FindAndSolve";
           string str1 = string.Intern(str);


Hello FindAndSolve

Hello FindAndSolve