using
System;
class
GFG {
public
static
void
Main()
{
string
strA =
"GeeksforGeeks"
;
string
strB =
"GFG"
;
string
strC =
"Noida"
;
string
strD = String.Intern(strA);
string
strE = String.Intern(strC);
Console.WriteLine(
"string A == '{0}'"
, strA);
Console.WriteLine(
"string B == '{0}'"
, strB);
Console.WriteLine(
"string C == '{0}'"
, strC);
Console.WriteLine(
"string D == '{0}'"
, strD);
Console.WriteLine(
"string E == '{0}'"
, strE);
Console.WriteLine();
Console.WriteLine(
"Is string A have the same reference as string B: {0}"
,
(Object)strA == (Object)strB);
Console.WriteLine(
"Is string B have the same reference as string C: {0}"
,
(Object)strB == (Object)strC);
Console.WriteLine(
"Is string D have the same reference as string E: {0}"
,
(Object)strD == (Object)strE);
Console.WriteLine(
"Is string A have the same reference as string D: {0}"
,
(Object)strA == (Object)strD);
Console.WriteLine(
"Is string E have the same reference as string C: {0}"
,
(Object)strE == (Object)strC);
}
}