using System;
using System.Runtime.InteropServices;
public class Program
{
public static void Main()
const string constStr = "000";
Mutate(constStr);
var nonConst = "000";
Console.WriteLine(nonConst);
void Mutate(string str)
var memory = MemoryMarshal.AsMemory(str.AsMemory());
memory.Span[0] = '4';
memory.Span[2] = '4';
}