Csharp 非安全代码
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { try { unsafe { fixed (char* a = "12345\0".ToCharArray()) { char[] c = new char[5]; for (int i = 0; i < 8; i++) { c[i] = a[i]; } Console.Out.WriteLine(c); } } } catch (Exception eee) { Console.Out.WriteLine(eee.Message); } } } }