string, const, ref and Intern
For Delphi developers who switched to C# and are used to
resort to the const keyword when they pass
string parameters and wonder how to do something
similar: there is no need for this. Yes, the const and
ref keywords exist, but they are used for something
else. The const keyword can be used in Delphi for
string parameters to gain performance by avoiding that a new
copy of the string be created.
In .NET, string references are kept in a pool whenever
possible. Creations of new string instances are avoided
as much as possible. When you pass a string as a
parameter, its value is the same inside the method as outside
the method, so only one reference is used.
You can get more information by paying a visit to the
String.Intern
method documentation.