This PR adds a static StringCache class that can be used to intern frequently-used strings to reduce memory usage.
StringCache is based on a concept described here that demonstrates that alternatives to string.Intern can perform a similar function but with much better performance. The PR also adds extension methods to make it easy to add or retrieve interned strings e.g. return "Some string".InternToStringCache();.
This PR adds a static
StringCache
class that can be used to intern frequently-used strings to reduce memory usage.StringCache
is based on a concept described here that demonstrates that alternatives tostring.Intern
can perform a similar function but with much better performance. The PR also adds extension methods to make it easy to add or retrieve interned strings e.g.return "Some string".InternToStringCache();
.