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);
            }



            }
            
            

      
    }
}

posted @ 2014-02-01 21:29  正月龙  阅读(267)  评论(0编辑  收藏  举报
留言板