string interning - should this code only create 10 strings in memory?
- by CodingThunder
Seems to create a lot more. Please advice why or how to intern correctly here.
Thanks
IList<string> list = new List<string>(10000);
for (int i = 0; i < 10000; i++)
{
for (int k = 0; k < 10; k++)
{
list.Add(string.Intern(k.ToString()));
}
}
Console.WriteLine("intern Done");
Console.ReadLine();