Should changing the contents of a string like this cause an exception?
Consider the following code: using System; using System.Runtime.InteropServices; namespace Demo { class Program { static void Main(string[] args) { const string test = "ABCDEF"; // Strings are immutable, right? char[] chars = new StringToChar{str=test}.chr; chars[0] = 'X'; // On an x32 release or debug build or on an x64 debug build, // the following prints "XBCDEF". // On an x64 release build, it prints "ABXDEF". // In both cases, we have changed the contents of 'test' without using // any 'unsafe' code... Console.WriteLine(test); } } [StructLayout(LayoutKind.Explicit)] public struct