using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Explicit)]
class UnionLikeClass
{
// 64 bit
[FieldOffset(0)]
public System.UInt64 uint64;
// 32 bit
[FieldOffset(0)]
public System.UInt32 uint32_0;
[FieldOffset(4)]
public System.UInt32 uint32_1;
// 16bit
[FieldOffset(0)]
public System.UInt16 uint16_0;
[FieldOffset(2)]
public System.UInt16 uint16_1;
[FieldOffset(4)]
public System.UInt16 uint16_2;
[FieldOffset(6)]
public System.UInt16 uint16_3;
// 8bit
[FieldOffset(0)]
public System.Byte byte_0;
[FieldOffset(1)]
public System.Byte byte_1;
[FieldOffset(2)]
public System.Byte byte_2;
[FieldOffset(3)]
public System.Byte byte_3;
[FieldOffset(4)]
public System.Byte byte_4;
[FieldOffset(5)]
public System.Byte byte_5;
[FieldOffset(6)]
public System.Byte byte_6;
[FieldOffset(7)]
public System.Byte byte_7;
}
0 comments:
Post a Comment