C#实现联合体

2021-07-01 16:08

阅读:439

标签:str   field   实现   out   set   bsp   oat   color   type   

        [StructLayout(LayoutKind.Explicit, Size = 8)]
        public struct TypeTransform
        {
            [FieldOffset(0)]
            public float f;

            [FieldOffset(0)]
            public int i;

            [FieldOffset(0)]
            public double d;

            [FieldOffset(0)]
            public long l;

            //[FieldOffset(0)]
            //public byte b1;

            //[FieldOffset(1)]
            //public byte b2;

            //[FieldOffset(2)]
            //public byte b3;

            //[FieldOffset(3)]
            //public byte b4;
        }

 

C#实现联合体

标签:str   field   实现   out   set   bsp   oat   color   type   

原文地址:https://www.cnblogs.com/timeObjserver/p/9942987.html


评论


亲,登录后才可以留言!