Created
July 18, 2020 08:30
-
-
Save kusa-mochi/90a7c0ef8a5d580043af77cad6e63492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
namespace ConsoleApp1 | |
{ | |
[StructLayout(LayoutKind.Explicit)] | |
struct SampleUnion | |
{ | |
[FieldOffset(0)] | |
public uint x; | |
[FieldOffset(0)] | |
public byte byte1; | |
[FieldOffset(1)] | |
public byte byte2; | |
[FieldOffset(2)] | |
public byte byte3; | |
[FieldOffset(3)] | |
public byte byte4; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment