I have an application that have ~1,000,000 strings in memory for performance reasons. My application consumes ~200 MB RAM.

I want to reduce the amount of memory consumed by the strings.

I know .NET represents strings in UTF-16 encoding (2 byte per char). Most strings in my application contain pure english chars, so storing them in UTF-8 encoding will be 2 times more efficient than UTF-16.

Is there a way to store a string in memory in UTF-8 encoding while allowing standard string functions? (My needs including mostly IndexOf with StringComparison.OrdinalIgnoreCase).

Edit
Report