C#不安全代码

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wodownload2/article/details/84636783

https://www.c-sharpcorner.com/article/pointers-and-unsafe-code-in-c-sharp-everything-you-need-to-know/

https://github.com/bridgedotnet/Bridge/blob/master/Bridge/shared/System/IO/BinaryReader.cs

在这里插入图片描述

  uint tmpBuffer = 2;
            unsafe
            {
                float a = *((float*)&tmpBuffer);
                Console.WriteLine(a);
                Console.WriteLine(BitConverter.ToSingle(BitConverter.GetBytes(tmpBuffer), 0));
            }

猜你喜欢

转载自blog.csdn.net/wodownload2/article/details/84636783