> For the complete documentation index, see [llms.txt](https://andreyakinshin.gitbook.io/problembookdotnet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andreyakinshin.gitbook.io/problembookdotnet/en/strings/corruptedstring-s.md).

# “CorruptedString” (Solution)

## Answer

You can use the internment mechanism:

```csharp
var s = "Hello";
string.Intern(s);
unsafe
{
  fixed (char* c = s)
    for (int i = 0; i < s.Length; i++)
      c[i] = 'a';
}
Console.WriteLine("Hello"); // Displays: "aaaaa"
```

[Problem](/problembookdotnet/en/strings/corruptedstring-p.md)
