Use of const in a method
- by kouPhax
In the following method,
public void InspectList(IList<int> values)
{
if(values != null)
{
const string format = "Element At {0}";
foreach(int i in values)
{
Log(string.Format(format, i));
}
}
}
Does the use of const provide any benefit over just declaring the string as a string? Woudl it not be interned anyway?